[cfe-dev] Question about type checking of vector type operand on Sema
John McCall
rjmccall at apple.com
Fri Jun 7 15:50:14 PDT 2013
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.
More information about the cfe-dev
mailing list