diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/Sema.h | 2 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 067c7a57df..9b2b6e54d8 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -1868,7 +1868,7 @@ public: bool isInc); QualType CheckAddressOfOperand(Expr *op, SourceLocation OpLoc); QualType CheckIndirectionOperand(Expr *op, SourceLocation OpLoc); - QualType CheckRealImagOperand(Expr *&Op, SourceLocation OpLoc); + QualType CheckRealImagOperand(Expr *&Op, SourceLocation OpLoc, bool isReal); /// type checking primary expressions. QualType CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc, diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index ad4f297388..0a61fe40c3 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1180,7 +1180,7 @@ Sema::ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType, Range.getEnd())); } -QualType Sema::CheckRealImagOperand(Expr *&V, SourceLocation Loc) { +QualType Sema::CheckRealImagOperand(Expr *&V, SourceLocation Loc, bool isReal) { DefaultFunctionArrayConversion(V); // These operators return the element type of a complex type. @@ -1192,7 +1192,8 @@ QualType Sema::CheckRealImagOperand(Expr *&V, SourceLocation Loc) { return V->getType(); // Reject anything else. - Diag(Loc, diag::err_realimag_invalid_type) << V->getType(); + Diag(Loc, diag::err_realimag_invalid_type) << V->getType() + << (isReal ? "__real" : "__imag"); return QualType(); } @@ -4058,7 +4059,7 @@ Action::OwningExprResult Sema::ActOnUnaryOp(Scope *S, SourceLocation OpLoc, break; case UnaryOperator::Real: case UnaryOperator::Imag: - resultType = CheckRealImagOperand(Input, OpLoc); + resultType = CheckRealImagOperand(Input, OpLoc, Opc == UnaryOperator::Real); break; case UnaryOperator::Extension: resultType = Input->getType(); |