aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-08-15 19:02:19 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-08-15 19:02:19 +0000
commit199ea95fd5ef9a089dbf7b2ade018d4444a65177 (patch)
tree317eaa9d9c266e7e03f8c9d40a384507e4bddee1
parent1d9b5efffaec2349f33510dee2cf2e90c3d2d6aa (diff)
Don't perform integer promotions on the operand to a cast; this
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
-rw-r--r--lib/Sema/SemaExpr.cpp2
-rw-r--r--test/Sema/vector-cast.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index ced300b4d7..1a519ffc1b 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -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.
diff --git a/test/Sema/vector-cast.c b/test/Sema/vector-cast.c
index 9460cac6d1..8c607aad07 100644
--- a/test/Sema/vector-cast.c
+++ b/test/Sema/vector-cast.c
@@ -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 \