[clang] [Clang] [Frontend] fix crash on parsing ternary operator with `vector_size` condition (PR #102004)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 6 08:53:23 PDT 2024


================
@@ -110,6 +110,10 @@ void Operands() {
   (void)(four_shorts ? four_shorts : uss); // expected-error {{cannot convert between scalar type 'unsigned short' and vector type 'FourShorts'}}
   (void)(four_ints ? four_floats : us);    // expected-error {{cannot convert between scalar type 'unsigned int' and vector type 'FourFloats'}}
   (void)(four_ints ? four_floats : sint);  // expected-error {{cannot convert between scalar type 'int' and vector type 'FourFloats'}}
+  (void)(four_ints ? &four_floats : &sint);  // expected-error {{vector operands to the vector conditional must be the same type ('FourFloats *' and 'int *')}}
----------------
AaronBallman wrote:

The rules seem to be different between C and C++ in GCC, and I can't quite suss out what Clang's rules actually are.

https://godbolt.org/z/q3Wea5sYd

CC @fhahn @simoll 

https://github.com/llvm/llvm-project/pull/102004


More information about the cfe-commits mailing list