http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00110.html
[official-gcc.git] / gcc / testsuite / g++.dg / tc1 / dr147.C
blob26ac6a60eccc774003011bc2cf995ed563757979
1 // { dg-do compile }
2 // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
3 // DR147: Naming the constructor (PR 11764) 
5 namespace N1 {
7 struct A { A(); };
8 struct B: public A { B(); };
10 A::A() { }
11 B::B() { }
13 B::A ba;
14 A::A a; // { dg-error "" "the injected-class-name can never be found through qualified lookup" { xfail *-*-* } }
18 namespace N2 {
20 // This is nasty: if we allowed the injected-class-name to be looked as a 
21 //  qualified type, then the following code would be well-formed. Basically
22 //  the last line is defining the static member (with redundant parenthesis).
23 // Instead, it should be rejected as a malformed constructor declaration.
25 template <class T> struct A {
26   template <class T2> A(T2);
27   static A x;
29 template<> A<int>::A<int>(A<int>::x);  // { dg-error "" "this is an invalid declaration of the constructor" { xfail *-*-* } }