re PR middle-end/71387 (ICE in emit_move_insn, at expr.c:3418 with -Og)
[platform/upstream/gcc.git] / gcc / testsuite / g++.dg / cpp0x / enum24.C
1 // PR c++/56749
2 // { dg-require-effective-target c++11 }
3
4 enum normal_enum
5 {
6     not_scoped1,
7     not_scoped2
8 };
9
10 enum class scoped_enum
11 {
12     scoped1,
13     scoped2
14 };
15
16 template <normal_enum N=not_scoped1>
17 class A
18 {
19 public:
20     template <typename T>
21         void fun ()
22         {
23         }
24 };
25
26 template <scoped_enum N=scoped_enum::scoped1>
27 class B
28 {
29 public:
30     template <typename T>
31         void fun ()
32         {
33         }
34 };
35
36
37 template <typename T>
38 void tfun ()
39 {
40     A<> a;
41     a.fun<char>(); //<------------ THIS IS FINE
42
43     B<> b_defaulted;
44     B<scoped_enum::scoped1> b_explicited;
45
46     b_defaulted.fun<char>();          //<------------ UNEXPECTED: THIS FAILS 
47     b_defaulted.template fun<char>(); //<------------ THIS IS FINE
48
49     b_explicited.fun<char>();         //<------------ UNEXPECTED: THIS FAILS 
50     b_explicited.template fun<char>();//<------------ THIS IS FINE
51 }
52
53 int main(int argc, char const *argv[])
54 {
55     tfun<int>();
56     return 0;
57 }