]> granicus.if.org Git - clang/commitdiff
Pass the right SourceLocation to Actions.ActOnOverloadedOperatorReferenceExpr and...
authorAnders Carlsson <andersca@mac.com>
Tue, 13 Oct 2009 21:02:07 +0000 (21:02 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 13 Oct 2009 21:02:07 +0000 (21:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84026 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseExpr.cpp
test/SemaCXX/incomplete-call.cpp

index d10e38cf68dca9429b8e5bacfbce882c7a116814..72e30e3b607967a6f6a5e029a301741ea56c0e1c 100644 (file)
@@ -983,12 +983,14 @@ Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
       } 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 @@ Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
             LHS = Actions.ActOnConversionOperatorReferenceExpr(CurScope,
                                                                move(LHS), OpLoc,
                                                                OpKind,
-                                                           Tok.getLocation(),
+                                                               OperatorLoc,
                                                                ConvType, &SS);
         } else {
           // Don't emit a diagnostic; ParseConversionFunctionId does it for us
index c61b61a9c649549741d5816c20e8da72354615de..a9f49d206a1e71da137b01525a7f350a2cef7b54 100644 (file)
@@ -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 @@ void g() {
   
   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'}}
 }