summaryrefslogtreecommitdiff
path: root/test/SemaTemplate
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2009-06-22 08:08:35 +0000
committerEd Schouten <ed@FreeBSD.org>2009-06-22 08:08:35 +0000
commitb897c8660c4ff7037dde81b9645737bc1c992abe (patch)
treeb6403365e77095a79062d3379c9e6aea0df5f088 /test/SemaTemplate
parent7ef7bab7e3d06f660b059b903c231f100bb13cc5 (diff)
Notes
Diffstat (limited to 'test/SemaTemplate')
-rw-r--r--test/SemaTemplate/ext-vector-type.cpp47
-rw-r--r--test/SemaTemplate/nested-template.cpp2
2 files changed, 48 insertions, 1 deletions
diff --git a/test/SemaTemplate/ext-vector-type.cpp b/test/SemaTemplate/ext-vector-type.cpp
new file mode 100644
index 0000000000000..d6c02bb629ff1
--- /dev/null
+++ b/test/SemaTemplate/ext-vector-type.cpp
@@ -0,0 +1,47 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+template<typename T, unsigned Length>
+struct make1 {
+ typedef T __attribute__((ext_vector_type(Length))) type;
+};
+
+int test_make1() {
+ make1<int, 5>::type x;
+ x.x = 4;
+}
+
+template<typename T, unsigned Length>
+struct make2 {
+ typedef T __attribute__((ext_vector_type(Length))) type; // expected-error{{zero vector size}}
+};
+
+int test_make2() {
+ make2<int, 0> x; // expected-note{{in instantiation of}}
+}
+
+template<typename T, unsigned Length>
+struct make3 {
+ typedef T __attribute__((ext_vector_type(Length))) type; // expected-error{{invalid vector type 'struct s'}}
+};
+
+struct s {};
+
+int test_make3() {
+ make3<s, 3>x; // expected-note{{in instantiation of}}
+}
+
+template<typename T, T Length>
+struct make4 {
+ typedef T __attribute__((ext_vector_type(Length))) type;
+};
+
+int test_make4() {
+ make4<int, 4>::type x;
+ x.w = 7;
+}
+
+typedef int* int_ptr;
+template<unsigned Length>
+struct make5 {
+ typedef int_ptr __attribute__((ext_vector_type(Length))) type; // expected-error{{invalid vector type}}
+};
+
diff --git a/test/SemaTemplate/nested-template.cpp b/test/SemaTemplate/nested-template.cpp
index bd9e89f76a0a4..84b1d35ba91db 100644
--- a/test/SemaTemplate/nested-template.cpp
+++ b/test/SemaTemplate/nested-template.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only %s
+// RUN: clang-cc -fsyntax-only -verify %s
class A;