diff options
-rw-r--r-- | include/clang/Sema/DeclSpec.h | 4 | ||||
-rw-r--r-- | test/Parser/cxx-class.cpp | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h index 49460a5524..f147950f18 100644 --- a/include/clang/Sema/DeclSpec.h +++ b/include/clang/Sema/DeclSpec.h @@ -1655,6 +1655,10 @@ public: Context != FileContext) return false; + // Special names can't have direct initializers. + if (Name.getKind() != UnqualifiedId::IK_Identifier) + return false; + switch (Context) { case FileContext: case BlockContext: diff --git a/test/Parser/cxx-class.cpp b/test/Parser/cxx-class.cpp index 8b8caa585f..1b3dd41ee8 100644 --- a/test/Parser/cxx-class.cpp +++ b/test/Parser/cxx-class.cpp @@ -72,17 +72,16 @@ namespace ctor_error { Ctor(x[5]); // expected-error{{incomplete type}} Ctor(UnknownType *); // expected-error{{unknown type name 'UnknownType'}} + void operator+(UnknownType*); // expected-error{{unknown type name 'UnknownType'}} }; Ctor::Ctor (x) = { 0 }; // \ // expected-error{{qualified reference to 'Ctor' is a constructor name}} - // FIXME: These diagnostics are terrible. Ctor::Ctor(UnknownType *) {} // \ - // expected-error{{'Ctor' cannot be the name of a variable or data member}} \ - // expected-error{{use of undeclared identifier 'UnknownType'}} \ - // expected-error{{expected expression}} \ - // expected-error{{expected ';' after top level declarator}} + // expected-error{{unknown type name 'UnknownType'}} + void Ctor::operator+(UnknownType*) {} // \ + // expected-error{{unknown type name 'UnknownType'}} } // PR11109 must appear at the end of the source file |