summaryrefslogtreecommitdiff
path: root/test/SemaTemplate/attributes.cpp
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-07-13 17:21:42 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-07-13 17:21:42 +0000
commit4ba675006b5a8edfc48b6a9bd3dcf54a70cc08f2 (patch)
tree48b44512b5db8ced345df4a1a56b5065cf2a14d9 /test/SemaTemplate/attributes.cpp
parentd7279c4c177bca357ef96ff1379fd9bc420bfe83 (diff)
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 b696c5cd98401..f4c1887c25e2c 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;
+}