[cfe-commits] r84026 - in /cfe/trunk: lib/Parse/ParseExpr.cpp test/SemaCXX/incomplete-call.cpp

Anders Carlsson andersca at mac.com
Tue Oct 13 14:02:07 PDT 2009


Author: andersca
Date: Tue Oct 13 16:02:07 2009
New Revision: 84026

URL: http://llvm.org/viewvc/llvm-project?rev=84026&view=rev
Log:
Pass the right SourceLocation to Actions.ActOnOverloadedOperatorReferenceExpr and Actions.ActOnConversionOperatorReferenceExpr. Update incomplete-call.cpp test.

Modified:
    cfe/trunk/lib/Parse/ParseExpr.cpp
    cfe/trunk/test/SemaCXX/incomplete-call.cpp

Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=84026&r1=84025&r2=84026&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Tue Oct 13 16:02:07 2009
@@ -983,12 +983,14 @@
       } else if (getLang().CPlusPlus && Tok.is(tok::kw_operator)) {
         // We have a reference to a member operator, e.g., t.operator int or
         // t.operator+.
+        SourceLocation OperatorLoc = Tok.getLocation();
+        
         if (OverloadedOperatorKind Op = TryParseOperatorFunctionId()) {
           if (!LHS.isInvalid())
             LHS = Actions.ActOnOverloadedOperatorReferenceExpr(CurScope,
                                                                move(LHS), OpLoc,
                                                                OpKind,
-                                                           Tok.getLocation(),
+                                                               OperatorLoc,
                                                                Op, &SS);
           // TryParseOperatorFunctionId already consumed our token, so
           // don't bother
@@ -997,7 +999,7 @@
             LHS = Actions.ActOnConversionOperatorReferenceExpr(CurScope,
                                                                move(LHS), OpLoc,
                                                                OpKind,
-                                                           Tok.getLocation(),
+                                                               OperatorLoc,
                                                                ConvType, &SS);
         } else {
           // Don't emit a diagnostic; ParseConversionFunctionId does it for us

Modified: cfe/trunk/test/SemaCXX/incomplete-call.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/incomplete-call.cpp?rev=84026&r1=84025&r2=84026&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/incomplete-call.cpp (original)
+++ cfe/trunk/test/SemaCXX/incomplete-call.cpp Tue Oct 13 16:02:07 2009
@@ -1,10 +1,12 @@
 // RUN: clang-cc -fsyntax-only -verify %s
-struct A; // expected-note 4 {{forward declaration of 'struct A'}}
+struct A; // expected-note 6 {{forward declaration of 'struct A'}}
 
 A f(); // expected-note {{note: 'f' declared here}}
 
 struct B {
   A f(); // expected-note {{'f' declared here}}
+  A operator()(); // expected-note {{'operator()' declared here}}
+  operator A(); // expected-note {{'operator A' declared here}}
 };
 
 void g() {
@@ -17,4 +19,7 @@
   
   B b;
   b.f(); // expected-error {{calling 'f' with incomplete return type 'struct A'}}
+  
+  b.operator()(); // expected-error {{calling 'operator()' with incomplete return type 'struct A'}}
+  b.operator A(); // expected-error {{calling 'operator A' with incomplete return type 'struct A'}}
 }





More information about the cfe-commits mailing list