summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2015-07-23 23:54:07 +0000
committerJohn McCall <rjmccall@apple.com>2015-07-23 23:54:07 +0000
commit1c78f085c35d0aefdc8790fdf898a7f95ff192a5 (patch)
tree514f72441aac10fd4d831f820db864fb6bf2fa5a /clang/test/Sema
parent3cfb62da14a9967aa0b4e8b17df33a0b2f43413e (diff)
downloadbcm5719-llvm-1c78f085c35d0aefdc8790fdf898a7f95ff192a5.tar.gz
bcm5719-llvm-1c78f085c35d0aefdc8790fdf898a7f95ff192a5.zip
Fix the equal-vector-size rule for reinterpret_casts in C++
to consider the storage size of the vector instead of its sizeof. In other words, ban <3 x int> to <4 x int> casts, which produced invalid IR anyway. Also, attempt to be a little more rigorous, or at least explicit, about when enums are allowed in these casts. rdar://21901132 llvm-svn: 243069
Diffstat (limited to 'clang/test/Sema')
-rw-r--r--clang/test/Sema/vector-cast.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Sema/vector-cast.c b/clang/test/Sema/vector-cast.c
index 0415c13990c..03db5408c45 100644
--- a/clang/test/Sema/vector-cast.c
+++ b/clang/test/Sema/vector-cast.c
@@ -3,12 +3,20 @@
typedef long long t1 __attribute__ ((vector_size (8)));
typedef char t2 __attribute__ ((vector_size (16)));
typedef float t3 __attribute__ ((vector_size (16)));
+typedef short s2 __attribute__ ((vector_size(4)));
+
+typedef enum { Evalue = 0x10000 } E;
void f()
{
t1 v1;
t2 v2;
t3 v3;
+ s2 v4;
+ E e;
+
+ e = (E)v4;
+ v4 = (s2)e;
v2 = (t2)v1; // expected-error {{invalid conversion between vector type \
't2' (vector of 16 'char' values) and 't1' (vector of 1 'long long' value) of different size}}
OpenPOWER on IntegriCloud