xref: /minix3/external/bsd/llvm/dist/clang/test/SemaTemplate/instantiate-enum.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc template<typename T, T I, int J>
4*f4a2713aSLionel Sambuc struct adder {
5*f4a2713aSLionel Sambuc   enum {
6*f4a2713aSLionel Sambuc     value = I + J,
7*f4a2713aSLionel Sambuc     value2
8*f4a2713aSLionel Sambuc   };
9*f4a2713aSLionel Sambuc };
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc int array1[adder<long, 3, 4>::value == 7? 1 : -1];
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc namespace PR6375 {
14*f4a2713aSLionel Sambuc   template<typename T>
15*f4a2713aSLionel Sambuc   void f() {
16*f4a2713aSLionel Sambuc     enum Enum
17*f4a2713aSLionel Sambuc     {
18*f4a2713aSLionel Sambuc       enumerator1 = 0xFFFFFFF,
19*f4a2713aSLionel Sambuc       enumerator2 = enumerator1 - 1
20*f4a2713aSLionel Sambuc     };
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc     int xb1 = enumerator1;
23*f4a2713aSLionel Sambuc     int xe1 = enumerator2;
24*f4a2713aSLionel Sambuc   }
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc   template void f<int>();
27*f4a2713aSLionel Sambuc }
28