From 957c8b1c701491f56a6b7cdeec0894530d3aec04 Mon Sep 17 00:00:00 2001 From: Kaelyn Uhrain Date: Wed, 31 Jul 2013 20:16:17 +0000 Subject: [PATCH] A few small cleanups to r187504. Thanks to dblaikie for the assist. llvm-svn: 187521 --- clang/lib/Sema/SemaExprCXX.cpp | 15 +++++++-------- clang/test/FixIt/fixit.cpp | 12 ++++++++++++ clang/test/SemaCXX/member-expr.cpp | 2 ++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 78dce61..ee2eb6d 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -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(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(Base); + if (Decl *CD = (CE ? CE->getCalleeDecl() : 0)) { + Diag(CD->getLocStart(), + diag::note_member_reference_arrow_from_operator_arrow); } } return ExprError(); diff --git a/clang/test/FixIt/fixit.cpp b/clang/test/FixIt/fixit.cpp index 3bd5b57..52bbb38 100644 --- a/clang/test/FixIt/fixit.cpp +++ b/clang/test/FixIt/fixit.cpp @@ -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 '.'?}} + } +} diff --git a/clang/test/SemaCXX/member-expr.cpp b/clang/test/SemaCXX/member-expr.cpp index e2462aa..cd8951f 100644 --- a/clang/test/SemaCXX/member-expr.cpp +++ b/clang/test/SemaCXX/member-expr.cpp @@ -79,9 +79,11 @@ namespace test5 { }; void test0(int x) { + x.A::foo(); // expected-error {{'int' is not a structure or union}} } void test1(A *x) { + x.A::foo(); // expected-error {{'test5::A *' is a pointer}} } void test2(A &x) { -- 2.7.4