summaryrefslogtreecommitdiffstats
path: root/test/SemaTemplate/attributes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaTemplate/attributes.cpp')
-rw-r--r--test/SemaTemplate/attributes.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/test/SemaTemplate/attributes.cpp b/test/SemaTemplate/attributes.cpp
index b696c5c..f4c1887 100644
--- a/test/SemaTemplate/attributes.cpp
+++ b/test/SemaTemplate/attributes.cpp
@@ -1,8 +1,21 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-template<int N>
-struct X {
- struct __attribute__((__aligned__((N)))) Aligned { }; // expected-error{{'aligned' attribute requires integer constant}}
+namespace attribute_aligned {
+ template<int N>
+ struct X {
+ char c[1] __attribute__((__aligned__((N)))); // expected-error {{alignment is not a power of 2}}
+ };
- int __attribute__((__address_space__(N))) *ptr; // expected-error{{attribute requires 1 argument(s)}}
-};
+ template <bool X> struct check {
+ int check_failed[X ? 1 : -1]; // expected-error {{array size is negative}}
+ };
+
+ template <int N> struct check_alignment {
+ typedef check<N == sizeof(X<N>)> t; // expected-note {{in instantiation}}
+ };
+
+ check_alignment<1>::t c1;
+ check_alignment<2>::t c2;
+ check_alignment<3>::t c3; // expected-note 2 {{in instantiation}}
+ check_alignment<4>::t c4;
+}
OpenPOWER on IntegriCloud