From efd009de1c1ff206d32aa2b9db96bfc6a25d5256 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 27 Mar 2012 00:56:56 +0000 Subject: When we see 'Class(X' or 'Class::Class(X' and we suspect that it names a constructor, but X is not a known typename, check whether the tokens could possibly match the syntax of a declarator before concluding that it isn't a constructor. If it's definitely ill-formed, assume it is a constructor. Empirical evidence suggests that this pattern is much more often a constructor with a typoed (or not-yet-declared) type name than any of the other possibilities, so the extra cost of the check is not expected to be problematic. llvm-svn: 153488 --- clang/test/SemaCXX/copy-assignment.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'clang/test/SemaCXX/copy-assignment.cpp') diff --git a/clang/test/SemaCXX/copy-assignment.cpp b/clang/test/SemaCXX/copy-assignment.cpp index 7aca9d6a80a..798582c149c 100644 --- a/clang/test/SemaCXX/copy-assignment.cpp +++ b/clang/test/SemaCXX/copy-assignment.cpp @@ -98,18 +98,13 @@ void test() { } // : Don't crash -// FIXME: the recovery here is really bad. namespace test1 { template class A : public unknown::X { // expected-error {{undeclared identifier 'unknown'}} expected-error {{expected class name}} - A(UndeclaredType n) : X(n) {} // expected-error{{expected ')'}} expected-note{{to match this '('}} \ - // expected-error{{use of undeclared identifier 'n'}} \ - // expected-error{{expected ';' at end of declaration list}} \ - // expected-error{{field has incomplete type 'test1::A'}} + A(UndeclaredType n) : X(n) {} // expected-error {{unknown type name 'UndeclaredType'}} }; template class B : public A { virtual void foo() {} }; - extern template class A; // expected-note {{in instantiation of template class 'test1::A' requested here}} \ - // expected-note {{definition of 'test1::A' is not complete until the closing '}'}} + extern template class A; extern template class B; } -- cgit v1.2.3