1 // { dg-do compile { target c++11 } }
2 
3 //This error is diagnosed at instantiation time
4 template<typename T> struct S1
5 {
6     enum E : T;   // { dg-error "previous definition" }
7     enum E : int;     // { dg-error "different underlying type" }
8 };
9 template struct S1<short>; // { dg-message "required from here" }
10 
11 template<typename T> struct S2
12 {
13     enum E : T;
14     enum E : T;
15 };
16 template struct S2<short>;
17 
18 template<typename T1, typename T2> struct S3
19 {
20     enum E : T1;
21     enum E : T2;
22 };
23 template struct S3<short,short>;
24 
25 template<typename T1, typename T2> struct S4
26 {
27     enum E : T1; // { dg-error "previous definition" }
28     enum E : T2; // { dg-error "different underlying type" }
29 };
30 template struct S4<short,char>; // { dg-message "required from here" }
31