summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/default-expr-arguments-3.cpp
blob: 3fd6bcd1bde312d20b42df4d5b6362683aba4803 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// FIXME: Remove the next line after a bit; this test used to
// write a .ll file and that confuses the bots. The next line
// cleans that up.
// RUN: rm -f %S/default-expr-arguments-3.ll
// RUN: %clang_cc1 -std=c++14 -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>();
OpenPOWER on IntegriCloud