]> granicus.if.org Git - clang/commitdiff
Make this error less specific but also less likely to cause confusion. Fixes
authorNick Lewycky <nicholas@mxc.ca>
Wed, 3 Nov 2010 17:52:57 +0000 (17:52 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Wed, 3 Nov 2010 17:52:57 +0000 (17:52 +0000)
PR7702.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118181 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticParseKinds.td
lib/Parse/ParseExprCXX.cpp
test/SemaCXX/invalid-member-expr.cpp
test/SemaCXX/member-operator-expr.cpp
test/SemaCXX/new-delete.cpp

index 273abe11830aae872d98f41e7ad3291346cf0bff..93f5bbcba80f0b72699589dc62eb99d6eb04d771 100644 (file)
@@ -293,8 +293,6 @@ def err_default_arg_unparsed : Error<
 def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">;
 
 // C++ operator overloading
-def err_operator_missing_type_specifier : Error<
-  "missing type specifier after 'operator'">;
 def err_operator_string_not_empty : Error<
   "string literal after 'operator' must be '\"\"'">;
 
index 7b03757cdca579672048acc246c30905919c5046..1d09fe2a1afbe0a06e69210b1725a883901ece63 100644 (file)
@@ -1005,7 +1005,7 @@ bool Parser::ParseCXXTypeSpecifierSeq(DeclSpec &DS) {
   // Parse one or more of the type specifiers.
   if (!ParseOptionalTypeSpecifier(DS, isInvalid, PrevSpec, DiagID,
       ParsedTemplateInfo(), /*SuppressDeclarations*/true)) {
-    Diag(Tok, diag::err_operator_missing_type_specifier);
+    Diag(Tok, diag::err_expected_type);
     return true;
   }
 
index 7307a47f8282c1595a303816d6f8108b44041662..37025d93344a7f61d55286657aabb97383488cbe 100644 (file)
@@ -7,8 +7,8 @@ void test() {
 
   x.int; // expected-error{{expected unqualified-id}}
   x.~int(); // expected-error{{expected a class name}}
-  x.operator; // expected-error{{missing type specifier after 'operator'}}
-  x.operator typedef; // expected-error{{missing type specifier after 'operator'}}
+  x.operator; // expected-error{{expected a type}}
+  x.operator typedef; // expected-error{{expected a type}}
 }
 
 void test2() {
@@ -16,8 +16,8 @@ void test2() {
 
   x->int; // expected-error{{expected unqualified-id}}
   x->~int(); // expected-error{{expected a class name}}
-  x->operator; // expected-error{{missing type specifier after 'operator'}}
-  x->operator typedef; // expected-error{{missing type specifier after 'operator'}}
+  x->operator; // expected-error{{expected a type}}
+  x->operator typedef; // expected-error{{expected a type}}
 }
 
 // PR6327
index 5e3d0c0a1bc85f67a52d0ea164d760666d3b718e..ae5f8bb0ddb69f252baa52c81b7ca96a59fbf2f2 100644 (file)
@@ -14,7 +14,7 @@ void test() {
   i = x.operator int();
   x.operator--(); // expected-error{{no member named 'operator--'}}
   x.operator float(); // expected-error{{no member named 'operator float'}}
-  x.operator; // expected-error{{missing type specifier after 'operator'}}
+  x.operator; // expected-error{{expected a type}}
 }
 
 void test2() {
@@ -25,5 +25,5 @@ void test2() {
   i = x->operator int();
   x->operator--(); // expected-error{{no member named 'operator--'}}
   x->operator float(); // expected-error{{no member named 'operator float'}}
-  x->operator; // expected-error{{missing type specifier after 'operator'}}
+  x->operator; // expected-error{{expected a type}}
 }
index f6129d19841b46baa62191221c32e7b9702a939a..19d5df6673ef847de2efbb2b31ea705f0f148f62 100644 (file)
@@ -62,8 +62,8 @@ struct abstract {
 void bad_news(int *ip)
 {
   int i = 1;
-  (void)new; // expected-error {{missing type specifier}}
-  (void)new 4; // expected-error {{missing type specifier}}
+  (void)new; // expected-error {{expected a type}}
+  (void)new 4; // expected-error {{expected a type}}
   (void)new () int; // expected-error {{expected expression}}
   (void)new int[1.1]; // expected-error {{array size expression must have integral or enumerated type, not 'double'}}
   (void)new int[1][i]; // expected-error {{only the first dimension}}
@@ -372,3 +372,9 @@ namespace PairedDelete {
     return new A<int>();
   }
 }
+
+namespace PR7702 {
+  void test1() {
+    new DoesNotExist; // expected-error {{expected a type}}
+  }
+}