]> granicus.if.org Git - clang/commitdiff
Fix a GCC warning:
authorChris Lattner <sabre@nondot.org>
Mon, 16 Jul 2007 21:39:03 +0000 (21:39 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 16 Jul 2007 21:39:03 +0000 (21:39 +0000)
SemaExpr.cpp:561: warning: dereferencing type-punned pointer will break strict-aliasing rules

Patch by Benoit Boissinot!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39928 91177308-0d34-0410-b5e6-96231b3b80d8

Sema/SemaExpr.cpp

index 3a7635b2521451eab26d574211bb9dba478de6a6..905bc1354e3ac5f9088328d53f8a7f17d677a15e 100644 (file)
@@ -558,11 +558,13 @@ Action::ExprResult Sema::ParseConditionalOp(SourceLocation QuestionLoc,
                                             SourceLocation ColonLoc,
                                             ExprTy *Cond, ExprTy *LHS,
                                             ExprTy *RHS) {
-  QualType result = CheckConditionalOperands((Expr *&)Cond, (Expr *&)LHS, 
-                                             (Expr *&)RHS, QuestionLoc);
+  Expr *CondExpr = (Expr *) Cond;
+  Expr *LHSExpr = (Expr *) LHS, *RHSExpr = (Expr *) RHS;
+  QualType result = CheckConditionalOperands(CondExpr, LHSExpr, 
+                                             RHSExpr, QuestionLoc);
   if (result.isNull())
     return true;
-  return new ConditionalOperator((Expr*)Cond, (Expr*)LHS, (Expr*)RHS, result);
+  return new ConditionalOperator(CondExpr, LHSExpr, RHSExpr, result);
 }
 
 // promoteExprToType - a helper function to ensure we create exactly one