summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/g++.dg/cpp0x/forw_enum10.C
blob: a57c0a9f415469f3fc4c8f9b46932fff156b1551 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// { dg-do compile }
// { dg-options "-std=c++0x" }

//This error is diagnosed at instantiation time
template<typename T> struct S1
{
    enum E : T;   // { dg-error "previous definition" }
    enum E : int;     // { dg-error "different underlying type" }
};
template struct S1<short>; // { dg-message "required from here" }

template<typename T> struct S2
{
    enum E : T;
    enum E : T;
};
template struct S2<short>;

template<typename T1, typename T2> struct S3
{
    enum E : T1;
    enum E : T2;
};
template struct S3<short,short>;

template<typename T1, typename T2> struct S4
{
    enum E : T1; // { dg-error "previous definition" }
    enum E : T2; // { dg-error "different underlying type" }
};
template struct S4<short,char>; // { dg-message "required from here" }
OpenPOWER on IntegriCloud