[cfe-dev] Question about type checking of vector type operand on Sema

jingu jingu at codeplay.com
Fri Jun 7 15:54:38 PDT 2013


2013-06-08 오전 7:50, John McCall 쓴 글:
> On Jun 7, 2013, at 8:16 AM, JinGu Kang <jingu at codeplay.com> wrote:
>> I have a question about type checking of vector type operand on Sema.
>>
>> I tested a code and clang generated error as following:
>>
>> source code:
>> typedef float float2  __attribute__((ext_vector_type(2)));
>>
>> void test(float2 a, float2 b) {
>>   float2 t0 = (a + b) / 2;
>> }
>>
>> error: can't convert between vector values of different size
>>       ('float __attribute__((ext_vector_type(2)))' and 'float')
>>   float2 t0 = (a + b) / 2;
>>                  ~~~~~~~ ^ ~
>>
>> The problem is that "Sema::CheckVectorOperands()" function does not consider about the case of float vector and integer scalar. Does someone let me know why clang prevents this case? I couldn't find some information. I think clang need to support this case. Given this case, I send a simple patch to process this case.
> This looks good overall, but please add test cases for the new behavior.
>
> John.
Hi John,

Thanks for your response. Could let me know how to add test cases? I did 
not have experience to do that.

Regards,
JinGu Kang



More information about the cfe-dev mailing list