[cfe-commits] r118181 - in /cfe/trunk: 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
Nick Lewycky
nicholas at mxc.ca
Wed Nov 3 10:52:57 PDT 2010
Author: nicholas
Date: Wed Nov 3 12:52:57 2010
New Revision: 118181
URL: http://llvm.org/viewvc/llvm-project?rev=118181&view=rev
Log:
Make this error less specific but also less likely to cause confusion. Fixes
PR7702.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/test/SemaCXX/invalid-member-expr.cpp
cfe/trunk/test/SemaCXX/member-operator-expr.cpp
cfe/trunk/test/SemaCXX/new-delete.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=118181&r1=118180&r2=118181&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Wed Nov 3 12:52:57 2010
@@ -293,8 +293,6 @@
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 '\"\"'">;
Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=118181&r1=118180&r2=118181&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Wed Nov 3 12:52:57 2010
@@ -1005,7 +1005,7 @@
// 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;
}
Modified: cfe/trunk/test/SemaCXX/invalid-member-expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/invalid-member-expr.cpp?rev=118181&r1=118180&r2=118181&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/invalid-member-expr.cpp (original)
+++ cfe/trunk/test/SemaCXX/invalid-member-expr.cpp Wed Nov 3 12:52:57 2010
@@ -7,8 +7,8 @@
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 @@
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
Modified: cfe/trunk/test/SemaCXX/member-operator-expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/member-operator-expr.cpp?rev=118181&r1=118180&r2=118181&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/member-operator-expr.cpp (original)
+++ cfe/trunk/test/SemaCXX/member-operator-expr.cpp Wed Nov 3 12:52:57 2010
@@ -14,7 +14,7 @@
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 @@
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}}
}
Modified: cfe/trunk/test/SemaCXX/new-delete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/new-delete.cpp?rev=118181&r1=118180&r2=118181&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/new-delete.cpp (original)
+++ cfe/trunk/test/SemaCXX/new-delete.cpp Wed Nov 3 12:52:57 2010
@@ -62,8 +62,8 @@
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 @@
return new A<int>();
}
}
+
+namespace PR7702 {
+ void test1() {
+ new DoesNotExist; // expected-error {{expected a type}}
+ }
+}
More information about the cfe-commits
mailing list