]> granicus.if.org Git - clang/commitdiff
Don't perform integer promotions on the operand to a cast; this
authorEli Friedman <eli.friedman@gmail.com>
Sat, 15 Aug 2009 19:02:19 +0000 (19:02 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Sat, 15 Aug 2009 19:02:19 +0000 (19:02 +0000)
simplifies the AST, and can matter in some rare cases involving
casts to vector types. Patch by Enea Zaffanella.

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

lib/Sema/SemaExpr.cpp
test/Sema/vector-cast.c

index ced300b4d7312fb94b21dc1bfb71fa0cacd9d388..1a519ffc1b6e712302d2c1708b2b675e0b7bcd14 100644 (file)
@@ -2992,7 +2992,7 @@ bool Sema::CheckCastTypes(SourceRange TyR, QualType castType, Expr *&castExpr,
   if (getLangOptions().CPlusPlus)
     return CXXCheckCStyleCast(TyR, castType, castExpr, Kind, FunctionalStyle);
 
-  UsualUnaryConversions(castExpr);
+  DefaultFunctionArrayConversion(castExpr);
 
   // C99 6.5.4p2: the cast type needs to be void or scalar and the expression
   // type needs to be scalar.
index 9460cac6d18707a3cc4486d2a2b6a8fa4a051a3e..8c607aad073e70e80d063c9b699b0f86f696fe00 100644 (file)
@@ -20,7 +20,7 @@ void f()
 type 't1' and scalar type 'char *'}}
   v1 = (t1)(long long)10;
   v1 = (t1)(short)10; // -expected-error {{invalid conversion between vector \
-type 't1' and integer type 'int' of different size}}
+type 't1' and integer type 'short' of different size}}
   
   long long r1 = (long long)v1;
   short r2 = (short)v1; // -expected-error {{invalid conversion between vector \