[cfe-commits] r51202 - /cfe/trunk/lib/Sema/SemaExpr.cpp

Eli Friedman eli.friedman at gmail.com
Fri May 16 13:37:08 PDT 2008


Author: efriedma
Date: Fri May 16 15:37:07 2008
New Revision: 51202

URL: http://llvm.org/viewvc/llvm-project?rev=51202&view=rev
Log:
Sema-based fix for PR2334.  The issue is that even if the two sides of 
the condidtional have compatible types, they are not necessarily the 
same type.  Therefore, we cast to the composite type.  As a hack, for 
the moment we assume that the composite type is the type of the 
left-hand expression; this isn't correct, but it's good enough for most 
purposes.


Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=51202&r1=51201&r2=51202&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri May 16 15:37:07 2008
@@ -920,9 +920,12 @@
       // differently qualified versions of compatible types, the result type is
       // a pointer to an appropriately qualified version of the *composite*
       // type.
-      // FIXME: Need to return the composite type.
+      // FIXME: Need to calculate the composite type.
       // FIXME: Need to add qualifiers
-      return lexT;
+      QualType compositeType = lexT;
+      ImpCastExprToType(lex, compositeType);
+      ImpCastExprToType(rex, compositeType);
+      return compositeType;
     }
   }
   





More information about the cfe-commits mailing list