Summary: changed some conditions in Sema/SemaInit.cpp to check for
ExtVectorType instead of getLangOpts().OpenCL && VectorType, and added
test case to Sema/vector-init.c.  Feedback appreciated.

Regards,
--John Stratton
Index: test/Sema/vector-init.c
===================================================================
--- test/Sema/vector-init.c	(revision 179759)
+++ test/Sema/vector-init.c	(working copy)
@@ -33,6 +33,11 @@
 typedef float __attribute__((ext_vector_type (3))) float3;
 int test2[sizeof(float3) == sizeof(float4) ? 1 : -1];
 
+
+// PR15780
+typedef float __attribute__((ext_vector_type (2))) float2;
+float3 test3 = (float3){(float2){1.0f, 2.0f}, 3.0f};
+
 // rdar://problem/8345836
 typedef long long __attribute__((vector_size(16))) longlong2;
 typedef short __attribute__((vector_size(16))) short8;
Index: lib/Sema/SemaInit.cpp
===================================================================
--- lib/Sema/SemaInit.cpp	(revision 179759)
+++ lib/Sema/SemaInit.cpp	(working copy)
@@ -616,8 +616,7 @@
     // We have leftover initializers
     if (VerifyOnly) {
       if (SemaRef.getLangOpts().CPlusPlus ||
-          (SemaRef.getLangOpts().OpenCL &&
-           IList->getType()->isVectorType())) {
+          IList->getType()->isExtVectorType()) {
         hadError = true;
       }
       return;
@@ -1038,7 +1037,7 @@
     return;
   }
 
-  if (!SemaRef.getLangOpts().OpenCL) {
+  if (!VT->isExtVectorType()) {
     // If the initializing element is a vector, try to copy-initialize
     // instead of breaking it apart (which is doomed to failure anyway).
     Expr *Init = IList->getInit(Index);
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to