UsualArithmeticConversions is crashing with an assert

when comparing "float" and "const float".  This "fixes" the
issue, but may not be the right fix.  Steve, please review.

Testcase here: test/Sema/usual-float.c

llvm-svn: 43113
This commit is contained in:
Chris Lattner 2007-10-18 03:50:33 +00:00
parent 8569d77349
commit fac7ac4130
2 changed files with 8 additions and 2 deletions

View File

@ -868,8 +868,8 @@ QualType Sema::UsualArithmeticConversions(Expr *&lhsExpr, Expr *&rhsExpr,
QualType rhs = rhsExpr->getType();
// If both types are identical, no conversion is needed.
if (lhs == rhs)
return lhs;
if (lhs.getTypePtr() == rhs.getTypePtr())
return lhs.getQualifiedType(0);
// If either side is a non-arithmetic type (e.g. a pointer), we are done.
// The caller can deal with this (e.g. pointer + int).

View File

@ -0,0 +1,6 @@
// RUN: clang %s -fsyntax-only
void foo(int dir, int n, int tindex) {
const float PI = 3.142;
float ang = (float) tindex * (-dir*2.0f*PI/n);
}