A few small cleanups to r187504. Thanks to dblaikie for the assist.

llvm-svn: 187521
This commit is contained in:
Kaelyn Uhrain 2013-07-31 20:16:17 +00:00
parent 9a9aa228a8
commit 957c8b1c70
3 changed files with 21 additions and 8 deletions

View File

@ -5102,14 +5102,13 @@ Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc,
<< FixItHint::CreateReplacement(OpLoc, ".");
OpKind = tok::period;
break;
} else {
Diag(OpLoc, diag::err_typecheck_member_reference_arrow)
<< BaseType << Base->getSourceRange();
CallExpr *CE = dyn_cast<CallExpr>(Base);
if (Decl *CD = (CE ? CE->getCalleeDecl() : 0)) {
Diag(CD->getLocStart(),
diag::note_member_reference_arrow_from_operator_arrow);
}
}
Diag(OpLoc, diag::err_typecheck_member_reference_arrow)
<< BaseType << Base->getSourceRange();
CallExpr *CE = dyn_cast<CallExpr>(Base);
if (Decl *CD = (CE ? CE->getCalleeDecl() : 0)) {
Diag(CD->getLocStart(),
diag::note_member_reference_arrow_from_operator_arrow);
}
}
return ExprError();

View File

@ -326,3 +326,15 @@ namespace PR5898 {
return foo->(x) == y; // expected-error {{unexpected '->' in function call; perhaps remove the '->'?}}
}
}
namespace PR15045 {
class Cl0 {
public:
int a;
};
int f() {
Cl0 c;
return c->a; // expected-error {{member reference type 'PR15045::Cl0' is not a pointer; maybe you meant to use '.'?}}
}
}

View File

@ -79,9 +79,11 @@ namespace test5 {
};
void test0(int x) {
x.A::foo<int>(); // expected-error {{'int' is not a structure or union}}
}
void test1(A *x) {
x.A::foo<int>(); // expected-error {{'test5::A *' is a pointer}}
}
void test2(A &x) {