type traits for vector types

Hi!

I'd like to find out info about vectors at compile time.

For example I have these vector traits:
template <typename T>
struct VectorTraits {
    enum {
        VECTOR = 0
    };
};

template <>
struct VectorTraits<float __attribute__((ext_vector_type(2)))> {
    enum {
        VECTOR = 2
    };
};

template <>
struct VectorTraits<float> {
    enum {
        VECTOR = 1
    };
};

This fails with the following error:
error: redefinition of
      'VectorTraits<float>'
struct VectorTraits<float>
        ^~~~~~~~~~~~~~~~~~~

It seems clang can not specialize by vector type. But when I omit the vector specialization
the result for a vector type (i.e. VectorTraits<float2>::VECTOR) is 0.
The vector type does not count as its basic type at instantiation time.
Therefore this is a bug.

-Jochen

The template argument deduction and checking rules have no understanding of vector types (or extended vector types). You'll need to extend that for templates and vector types to work well together.

  - Doug