diff options
author | Erich Keane <erich.keane@intel.com> | 2018-07-10 20:46:46 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2018-07-10 20:46:46 +0000 |
commit | 7b8c12e7cc7e5a034a61d4e3978e02529104c382 (patch) | |
tree | 5b264e5f5191b8cf772349aab2dec8c21539aa8d /clang/test/SemaCXX/vector.cpp | |
parent | 79d55d30c3ea53bc22889a11113646b298b86063 (diff) | |
download | bcm5719-llvm-7b8c12e7cc7e5a034a61d4e3978e02529104c382.tar.gz bcm5719-llvm-7b8c12e7cc7e5a034a61d4e3978e02529104c382.zip |
[NFC] Switch CodeGenFunction to use value init instead of member init lists
The member init list for the sole constructor for CodeGenFunction
has gotten out of hand, so this patch moves the non-parameter-dependent
initializations into the member value inits.
llvm-svn: 336726
Diffstat (limited to 'clang/test/SemaCXX/vector.cpp')
-rw-r--r-- | clang/test/SemaCXX/vector.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/vector.cpp b/clang/test/SemaCXX/vector.cpp index 8fe24a32c86..56a8a6db5b6 100644 --- a/clang/test/SemaCXX/vector.cpp +++ b/clang/test/SemaCXX/vector.cpp @@ -291,3 +291,46 @@ const int &reference_to_vec_element = vi4(1).x; // PR12649 typedef bool bad __attribute__((__vector_size__(16))); // expected-error {{invalid vector element type 'bool'}} + +namespace Templates { +template <typename Elt, unsigned Size> +struct TemplateVectorType { + typedef Elt __attribute__((__vector_size__(Size))) type; +}; + +template <int N, typename T> +struct PR15730 { + typedef T __attribute__((vector_size(N * sizeof(T)))) type; + typedef T __attribute__((vector_size(8192))) type2; + typedef T __attribute__((vector_size(3))) type3; +}; + +void Init() { + const TemplateVectorType<float, 32>::type Works = {}; + const TemplateVectorType<int, 32>::type Works2 = {}; + // expected-error@298 {{invalid vector element type 'bool'}} + // expected-note@+1 {{in instantiation of template class 'Templates::TemplateVectorType<bool, 32>' requested here}} + const TemplateVectorType<bool, 32>::type NoBool; + // expected-error@298 {{invalid vector element type 'int __attribute__((ext_vector_type(4)))' (vector of 4 'int' values)}} + // expected-note@+1 {{in instantiation of template class 'Templates::TemplateVectorType<int __attribute__((ext_vector_type(4))), 32>' requested here}} + const TemplateVectorType<vi4, 32>::type NoComplex; + // expected-error@298 {{vector size not an integral multiple of component size}} + // expected-note@+1 {{in instantiation of template class 'Templates::TemplateVectorType<int, 33>' requested here}} + const TemplateVectorType<int, 33>::type BadSize; + // expected-error@298 {{vector size too large}} + // expected-note@+1 {{in instantiation of template class 'Templates::TemplateVectorType<int, 8192>' requested here}} + const TemplateVectorType<int, 8192>::type TooLarge; + // expected-error@298 {{zero vector size}} + // expected-note@+1 {{in instantiation of template class 'Templates::TemplateVectorType<int, 0>' requested here}} + const TemplateVectorType<int, 0>::type Zero; + + // expected-error@304 {{vector size too large}} + // expected-error@305 {{vector size not an integral multiple of component size}} + // expected-note@+1 {{in instantiation of template class 'Templates::PR15730<8, int>' requested here}} + const PR15730<8, int>::type PR15730_1 = {}; + // expected-error@304 {{vector size too large}} + // expected-note@+1 {{in instantiation of template class 'Templates::PR15730<8, char>' requested here}} + const PR15730<8, char>::type2 PR15730_2 = {}; +} + +} // namespace Templates |