1// { dg-do compile }
2// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
3// DR147: Naming the constructor (PR 11764)
4
5namespace N1 {
6
7struct A { A(); };
8struct B: public A { B(); };
9
10A::A() { }
11B::B() { }
12
13B::A ba;
14A::A a; // { dg-error "" "the injected-class-name can never be found through qualified lookup" { xfail *-*-* } }
15
16}
17
18namespace N2 {
19
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.
24
25template <class T> struct A {
26  template <class T2> A(T2);
27  static A x;
28};
29template<> A<int>::A<int>(A<int>::x);  // { dg-error "" "this is an invalid declaration of the constructor" { xfail *-*-* } }
30
31}
32