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

Eli Friedman eli.friedman at gmail.com
Wed Jun 4 12:47:51 PDT 2008


Author: efriedma
Date: Wed Jun  4 14:47:51 2008
New Revision: 51961

URL: http://llvm.org/viewvc/llvm-project?rev=51961&view=rev
Log:
Make sure the types are consistent for a void conditional.  No visible 
difference, but it's better to be consistent.


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=51961&r1=51960&r2=51961&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Jun  4 14:47:51 2008
@@ -917,15 +917,15 @@
   // C99 6.5.15p5: "If both operands have void type, the result has void type."
   // The following || allows only one side to be void (a GCC-ism).
   if (lexT->isVoidType() || rexT->isVoidType()) {
-    if (!lexT->isVoidType()) {
+    if (!lexT->isVoidType())
       Diag(rex->getLocStart(), diag::ext_typecheck_cond_one_void, 
            rex->getSourceRange());
-      return rexT.getUnqualifiedType();
-    }
     if (!rexT->isVoidType())
       Diag(lex->getLocStart(), diag::ext_typecheck_cond_one_void,
            lex->getSourceRange());
-    return lexT.getUnqualifiedType();
+    ImpCastExprToType(lex, Context.VoidTy);
+    ImpCastExprToType(rex, Context.VoidTy);
+    return Context.VoidTy;
   }
   // C99 6.5.15p6 - "if one operand is a null pointer constant, the result has
   // the type of the other operand."





More information about the cfe-commits mailing list