2016-12-17 04:25:11 +08:00
|
|
|
// RUN: %clang_cc1 -std=c++14 -verify -ast-dump %s | FileCheck %s
|
2016-12-16 11:19:41 +08:00
|
|
|
// expected-no-diagnostics
|
|
|
|
|
2016-12-17 04:25:11 +08:00
|
|
|
// CHECK: FunctionDecl {{.*}} used func 'void (void)'
|
|
|
|
// CHECK-NEXT: TemplateArgument type 'int'
|
|
|
|
// CHECK: LambdaExpr {{.*}} 'class (lambda at
|
|
|
|
// CHECK: ParmVarDecl {{.*}} used f 'enum foo' cinit
|
|
|
|
// CHECK-NEXT: DeclRefExpr {{.*}} 'enum foo' EnumConstant {{.*}} 'a' 'enum foo'
|
|
|
|
|
2016-12-16 11:19:41 +08:00
|
|
|
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>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-17 04:25:11 +08:00
|
|
|
// CHECK: ClassTemplateSpecializationDecl {{.*}} struct class2 definition
|
2017-09-22 08:11:15 +08:00
|
|
|
// CHECK: TemplateArgument type 'int'
|
2016-12-17 04:25:11 +08:00
|
|
|
// CHECK: LambdaExpr {{.*}} 'class (lambda at
|
|
|
|
// CHECK: ParmVarDecl {{.*}} used f 'enum foo' cinit
|
|
|
|
// CHECK-NEXT: DeclRefExpr {{.*}} 'enum foo' EnumConstant {{.*}} 'a' 'enum foo'
|
|
|
|
|
2016-12-16 11:19:41 +08:00
|
|
|
// 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>;
|
|
|
|
|
2016-12-17 04:25:11 +08:00
|
|
|
// CHECK: FunctionTemplateDecl {{.*}} f1
|
2017-02-21 10:04:03 +08:00
|
|
|
// CHECK-NEXT: TemplateTypeParmDecl {{.*}} typename depth 0 index 0 T
|
2016-12-17 04:25:11 +08:00
|
|
|
// CHECK-NEXT: FunctionDecl {{.*}} f1 'void (void)'
|
|
|
|
// CHECK: FunctionDecl {{.*}} f1 'void (void)'
|
|
|
|
// CHECK-NEXT: TemplateArgument type 'int'
|
|
|
|
// CHECK: ParmVarDecl {{.*}} n 'enum foo' cinit
|
|
|
|
// CHECK-NEXT: DeclRefExpr {{.*}} 'enum foo' EnumConstant {{.*}} 'a' 'enum foo'
|
|
|
|
|
2016-12-16 11:19:41 +08:00
|
|
|
template<typename T>
|
|
|
|
void f1() {
|
|
|
|
enum class foo { a, b };
|
|
|
|
struct S {
|
|
|
|
int g1(foo n = foo::a);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
template void f1<int>();
|