OSDN Git Service

PR c++/30849
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / parse / constant4.C
1 // { dg-do compile }
2
3 // Copyright (C) 2003 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 31 Jul 2003 <nathan@codesourcery.com>
5
6 // PR c++/11525 incorrect error about non-constant initalizer
7
8 template<typename> class X;
9 template<unsigned> class Y {};
10
11
12 template<typename T>
13 void Foo ()
14 {
15   static const unsigned I = X<T>::I;
16   
17   Y<I> i;
18   
19   static const unsigned J = X<T>::J;
20   
21   Y<J> j; // { dg-error "non-constant" "" }
22 }
23
24 struct A 
25 {
26   operator unsigned () const;
27 };
28
29 template <typename> struct X 
30 {
31   enum {I};
32   static A const J;
33 };
34
35 void Baz ()
36 {
37   Foo<int> (); // { dg-error "instantiated" "" }
38 }
39
40