[cfe-dev] Fwd: dependently-typed ext_vector_type

Roland Lei├ča leissa at cs.uni-saarland.de
Wed Apr 25 23:54:35 PDT 2012


Hi all,

the function
HandleExtVectorTypeAttr 
in 
lib/Sema/SemaType.cpp

does not check the number of given attibute parameters in the case, that we have a dependently-typed ext_vector. Thus, the following code compiles just fine:

template<int I>
struct foo {
    typedef  float __attribute__((ext_vector_type(I, 42))) type;
};

foo<23>::type bar1;
foo<23>::type bar2;
foo<23>::type bar3 = bar1 + bar2;


I could write a patch, which fixes this issue; however, I'm not 100% sure whether just checking the number of args is correct in all dependent cases. I'm thinking of C++11 variadic templates. 

-- 
Roland



More information about the cfe-dev mailing list