summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/vector.cpp
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2018-07-10 20:46:46 +0000
committerErich Keane <erich.keane@intel.com>2018-07-10 20:46:46 +0000
commit1437ede97caf39872f7378aabe147c80a76a5719 (patch)
treeadea4f7feb3beeda1626c384d3d55fb9ad353a26 /test/SemaCXX/vector.cpp
parent8275ce24a432238f23f42534d3b2b57741044e43 (diff)
[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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336726 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/vector.cpp')
-rw-r--r--test/SemaCXX/vector.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/SemaCXX/vector.cpp b/test/SemaCXX/vector.cpp
index 8fe24a32c8..56a8a6db5b 100644
--- a/test/SemaCXX/vector.cpp
+++ b/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