// RUN: %clang_cc1 -std=c++14 -emit-llvm -disable-llvm-optzns -verify %s
// expected-no-diagnostics

namespace PR28795 {
  template<typename T>
  void func() {
    enum class foo { a, b };
    auto bar = [](foo f = foo::a) { return f; };
    bar();
  }

  void foo() {
    func<int>();
  }
}

// Template struct case:
template <class T> struct class2 {
  void bar() {
    enum class foo { a, b };
    [](foo f = foo::a) { return f; }();
  }
};

template struct class2<int>;

template<typename T>
void f1() {
  enum class foo { a, b };
  struct S {
    int g1(foo n = foo::a);
  };
}

template void f1<int>();

// RUN: %clang_cc1 -std=c++14 -emit-llvm -o - %s
// expected-no-diagnostics

namespace PR28795 {
  template<typename T>
  void func() {
    enum class foo { a, b };
    auto bar = [](foo f = foo::a) { return f; };
    bar();
  }

  void foo() {
    func<int>();
  }
}

// Template struct case:
template <class T> struct class2 {
  void bar() {
    enum class foo { a, b };
    [](foo f = foo::a) { return f; }();
  }
};

template struct class2<int>;

template<typename T>
void f1() {
  enum class foo { a, b };
  struct S {
    int g1(foo n = foo::a);
  };
}

template void f1<int>();

Remove "-disable-llvm-optzns -verify" from the RUN line.
Remove "-disable-llvm-optzns -verify" from the RUN line.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@289919 91177308-0d34-0410-b5e6-96231b3b80d8
(cherry picked from commit 652c9fe88f966515fae0aaaa3d5bc91206c17d15)
