xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/cxx11-enum-template.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch %s -o %t
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t -verify %s
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc #ifndef HEADER_INCLUDED
5*f4a2713aSLionel Sambuc 
6*f4a2713aSLionel Sambuc #define HEADER_INCLUDED
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc template<typename T> struct S {
9*f4a2713aSLionel Sambuc   enum class E {
10*f4a2713aSLionel Sambuc     e = T()
11*f4a2713aSLionel Sambuc   };
12*f4a2713aSLionel Sambuc };
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc S<int> a;
15*f4a2713aSLionel Sambuc S<long>::E b;
16*f4a2713aSLionel Sambuc S<double>::E c;
17*f4a2713aSLionel Sambuc template struct S<char>;
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc #else
20*f4a2713aSLionel Sambuc 
21*f4a2713aSLionel Sambuc int k1 = (int)S<int>::E::e;
22*f4a2713aSLionel Sambuc int k2 = (int)decltype(b)::e;
23*f4a2713aSLionel Sambuc int k3 = (int)decltype(c)::e; // expected-error@10 {{conversion from 'double' to 'int'}} expected-note {{here}}
24*f4a2713aSLionel Sambuc int k4 = (int)S<char>::E::e;
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc #endif
27