From: Chris Lattner Date: Mon, 16 Jul 2007 21:39:03 +0000 (+0000) Subject: Fix a GCC warning: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26824906e5c1562485699e1d12bd2840fc94825f;p=clang Fix a GCC warning: 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 --- diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp index 3a7635b252..905bc1354e 100644 --- a/Sema/SemaExpr.cpp +++ b/Sema/SemaExpr.cpp @@ -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