diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2011-07-17 15:40:56 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2011-07-17 15:40:56 +0000 |
| commit | 180abc3db9ae3b4fc63cd65b15697e6ffcc8a657 (patch) | |
| tree | 2097d084eb235c0b12c0bff3445f4ec7bbaa8a12 /test/SemaTemplate/ext-vector-type.cpp | |
| parent | 29cafa66ad3878dbb9f82615f19fa0bded2e443c (diff) | |
Notes
Diffstat (limited to 'test/SemaTemplate/ext-vector-type.cpp')
| -rw-r--r-- | test/SemaTemplate/ext-vector-type.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/SemaTemplate/ext-vector-type.cpp b/test/SemaTemplate/ext-vector-type.cpp index 7334e88e9267d..f968c13f10238 100644 --- a/test/SemaTemplate/ext-vector-type.cpp +++ b/test/SemaTemplate/ext-vector-type.cpp @@ -58,3 +58,37 @@ int test_make6() { y.x = -1; y.w = -1; // expected-error{{vector component access exceeds type}} } + +namespace Deduction { + template<typename T> struct X0; + + template<typename T, unsigned N> + struct X0<T __attribute__((ext_vector_type(N)))> { + static const unsigned value = 0; + }; + + template<typename T> + struct X0<T __attribute__((ext_vector_type(4)))> { + static const unsigned value = 1; + }; + + template<unsigned N> + struct X0<float __attribute__((ext_vector_type(N)))> { + static const unsigned value = 2; + }; + + template<> + struct X0<float __attribute__((ext_vector_type(4)))> { + static const unsigned value = 3; + }; + + typedef int __attribute__((ext_vector_type(2))) int2; + typedef int __attribute__((ext_vector_type(4))) int4; + typedef float __attribute__((ext_vector_type(2))) float2; + typedef float __attribute__((ext_vector_type(4))) float4; + + int array0[X0<int2>::value == 0? 1 : -1]; + int array1[X0<int4>::value == 1? 1 : -1]; + int array2[X0<float2>::value == 2? 1 : -1]; + int array3[X0<float4>::value == 3? 1 : -1]; +} |
