Index: gcc/gcc/testsuite/g++.dg/tc1/dr147.C |
diff --git a/gcc/gcc/testsuite/g++.dg/tc1/dr147.C b/gcc/gcc/testsuite/g++.dg/tc1/dr147.C |
index 26ac6a60eccc774003011bc2cf995ed563757979..6799b7dccad0c17376e9f2b1ba264ee0d6d3b61a 100644 |
--- a/gcc/gcc/testsuite/g++.dg/tc1/dr147.C |
+++ b/gcc/gcc/testsuite/g++.dg/tc1/dr147.C |
@@ -4,15 +4,24 @@ |
namespace N1 { |
-struct A { A(); }; |
+struct A { A(); void f(); }; |
struct B: public A { B(); }; |
A::A() { } |
B::B() { } |
B::A ba; |
-A::A a; // { dg-error "" "the injected-class-name can never be found through qualified lookup" { xfail *-*-* } } |
+A::A a; // { dg-error "constructor" "the injected-class-name can never be found through qualified lookup" } |
+void A::f() |
+{ |
+ A::A(); // { dg-message "::A" "c++/42415" } |
+} |
+ |
+void f() |
+{ |
+ A::A a; // { dg-error "constructor" } |
+} // { dg-error "" "" { target *-*-* } 23 } error cascade |
} |
namespace N2 { |
@@ -26,6 +35,32 @@ template <class T> struct A { |
template <class T2> A(T2); |
static A x; |
}; |
-template<> A<int>::A<int>(A<int>::x); // { dg-error "" "this is an invalid declaration of the constructor" { xfail *-*-* } } |
+template<> template <> A<char>::A<char>(char); |
+template<> A<int>::A<int>(A<int>::x); // { dg-error "" "this is an invalid declaration of the constructor" } |
} |
+ |
+// But DR 318 says that in situations where a type is syntactically |
+// required, lookup finds it. |
+ |
+struct C |
+{ |
+ C(); |
+ typedef int T; |
+}; |
+struct C::C c; |
+C::C::T t; |
+struct D: C::C |
+{ |
+ D(): C::C() { } |
+}; |
+ |
+// And if lookup doesn't find the injected-class-name, we aren't naming the |
+// constructor (c++/44401). |
+ |
+struct E |
+{ |
+ int E; |
+}; |
+ |
+int E::*p = &E::E; |