[cfe-commits] r116624 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaCXX/PR7944.cpp
Nick Lewycky
nicholas at mxc.ca
Fri Oct 15 14:43:24 PDT 2010
Author: nicholas
Date: Fri Oct 15 16:43:24 2010
New Revision: 116624
URL: http://llvm.org/viewvc/llvm-project?rev=116624&view=rev
Log:
Report the location of the syntax error inside a macro. Fixes PR7944.
Added:
cfe/trunk/test/SemaCXX/PR7944.cpp
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=116624&r1=116623&r2=116624&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Oct 15 16:43:24 2010
@@ -3052,7 +3052,7 @@
ResultTy->getAs<PointerType>()->getPointeeType()
->isRecordType()))) {
SourceLocation Loc = PP.getLocForEndOfToken(BaseExpr->getLocEnd());
- Diag(Loc, diag::err_member_reference_needs_call)
+ Diag(BaseExpr->getExprLoc(), diag::err_member_reference_needs_call)
<< QualType(Fun, 0)
<< FixItHint::CreateInsertion(Loc, "()");
Added: cfe/trunk/test/SemaCXX/PR7944.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/PR7944.cpp?rev=116624&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/PR7944.cpp (added)
+++ cfe/trunk/test/SemaCXX/PR7944.cpp Fri Oct 15 16:43:24 2010
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// PR7944
+
+#define MACRO(x) x
+
+struct B { int f() { return 0; } };
+struct A { B* b() { return new B; } };
+
+void g() {
+ A a;
+ MACRO(a.b->f()); // expected-error{{base of member reference has function type}}
+}
More information about the cfe-commits
mailing list