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>
fun()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>
fun()31         void fun ()
32         {
33         }
34 };
35 
36 
37 template <typename T>
tfun()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 
main(int argc,char const * argv[])53 int main(int argc, char const *argv[])
54 {
55     tfun<int>();
56     return 0;
57 }
58