forked from OSchip/llvm-project
Pass the right SourceLocation to Actions.ActOnOverloadedOperatorReferenceExpr and Actions.ActOnConversionOperatorReferenceExpr. Update incomplete-call.cpp test.
llvm-svn: 84026
This commit is contained in:
parent
39a029d8a3
commit
8523d20af3
|
@ -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
|
||||
|
|
|
@ -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'}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue