Fix a GCC warning:

SemaExpr.cpp:561: warning: dereferencing type-punned pointer will break strict-aliasing rules

Patch by Benoit Boissinot!

llvm-svn: 39928
This commit is contained in:
Chris Lattner 2007-07-16 21:39:03 +00:00
parent e73e4322d6
commit daaa9f207c
1 changed files with 5 additions and 3 deletions

View 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