emit:
t.c:4:9: error: invalid type 'short *' to __real operator
                         __tg_choose (__real__(z), C##f(z), (C)(z), C##l(z)), 
                                      ^
instead of:
t.c:4:9: error: invalid type 'short *' to __real or __imag operator
                         __tg_choose (__real__(z), C##f(z), (C)(z), C##l(z)),
                                      ^

fixing a fixme.  It would be even fancier to get the spelling of the token, but I
don't care *that* much :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64759 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index ad4f297..0a61fe4 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1180,7 +1180,7 @@
                                                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 @@
     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 @@
     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();