xref: /minix3/external/bsd/llvm/dist/clang/test/SemaTemplate/instantiate-enum.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only %s
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc template<typename T, T I, int J>
4f4a2713aSLionel Sambuc struct adder {
5f4a2713aSLionel Sambuc   enum {
6f4a2713aSLionel Sambuc     value = I + J,
7f4a2713aSLionel Sambuc     value2
8f4a2713aSLionel Sambuc   };
9f4a2713aSLionel Sambuc };
10f4a2713aSLionel Sambuc 
11f4a2713aSLionel Sambuc int array1[adder<long, 3, 4>::value == 7? 1 : -1];
12f4a2713aSLionel Sambuc 
13f4a2713aSLionel Sambuc namespace PR6375 {
14f4a2713aSLionel Sambuc   template<typename T>
f()15f4a2713aSLionel Sambuc   void f() {
16f4a2713aSLionel Sambuc     enum Enum
17f4a2713aSLionel Sambuc     {
18f4a2713aSLionel Sambuc       enumerator1 = 0xFFFFFFF,
19f4a2713aSLionel Sambuc       enumerator2 = enumerator1 - 1
20f4a2713aSLionel Sambuc     };
21f4a2713aSLionel Sambuc 
22f4a2713aSLionel Sambuc     int xb1 = enumerator1;
23f4a2713aSLionel Sambuc     int xe1 = enumerator2;
24f4a2713aSLionel Sambuc   }
25f4a2713aSLionel Sambuc 
26f4a2713aSLionel Sambuc   template void f<int>();
27f4a2713aSLionel Sambuc }
28*0a6a1f1dSLionel Sambuc 
29*0a6a1f1dSLionel Sambuc namespace EnumScoping {
30*0a6a1f1dSLionel Sambuc 
31*0a6a1f1dSLionel Sambuc template <typename T>
32*0a6a1f1dSLionel Sambuc class C {
33*0a6a1f1dSLionel Sambuc   enum {
34*0a6a1f1dSLionel Sambuc     value = 42
35*0a6a1f1dSLionel Sambuc   };
36*0a6a1f1dSLionel Sambuc };
37*0a6a1f1dSLionel Sambuc 
f(int i,C<int>::C c)38*0a6a1f1dSLionel Sambuc void f(int i, C<int>::C c) {
39*0a6a1f1dSLionel Sambuc   int value;
40*0a6a1f1dSLionel Sambuc }
41*0a6a1f1dSLionel Sambuc 
42*0a6a1f1dSLionel Sambuc }
43