Index: cfe/trunk/lib/Sema/SemaExprMember.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaExprMember.cpp +++ cfe/trunk/lib/Sema/SemaExprMember.cpp @@ -384,7 +384,9 @@ } } - if (!HalvingSwizzle) { + // OpenCL mode requires swizzle length to be in accordance with accepted + // sizes. Clang however supports arbitrary lengths for other languages. + if (S.getLangOpts().OpenCL && !HalvingSwizzle) { unsigned SwizzleLength = CompName->getLength(); if (HexSwizzle) Index: cfe/trunk/test/Sema/vector_swizzle_length.c =================================================================== --- cfe/trunk/test/Sema/vector_swizzle_length.c +++ cfe/trunk/test/Sema/vector_swizzle_length.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -x c %s -verify -pedantic -fsyntax-only +// expected-no-diagnostics + +typedef float float8 __attribute__((ext_vector_type(8))); + +void foo() { + float8 f2 = (float8){0, 0, 0, 0, 0, 0, 0, 0}; + (void)f2.s01234; + (void)f2.xyzxy; +} Index: cfe/trunk/test/SemaOpenCL/vector_swizzle_length.cl =================================================================== --- cfe/trunk/test/SemaOpenCL/vector_swizzle_length.cl +++ cfe/trunk/test/SemaOpenCL/vector_swizzle_length.cl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only +// RUN: %clang_cc1 -x cl %s -verify -pedantic -fsyntax-only typedef float float8 __attribute__((ext_vector_type(8)));