blob: e208bd2b89908b5189d517eda99a515f3567c6d1 [file] [log] [blame]
Douglas Gregorac06a0e2010-05-18 23:01:22 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2
Chandler Carruth4ced79f2010-06-25 03:22:07 +00003namespace attribute_aligned {
4 template<int N>
5 struct X {
6 char c[1] __attribute__((__aligned__((N)))); // expected-error {{alignment is not a power of 2}}
7 };
Douglas Gregorac06a0e2010-05-18 23:01:22 +00008
Chandler Carruth4ced79f2010-06-25 03:22:07 +00009 template <bool X> struct check {
Chandler Carruthb2b5cc02011-01-04 04:44:35 +000010 int check_failed[X ? 1 : -1]; // expected-error {{array with a negative size}}
Chandler Carruth4ced79f2010-06-25 03:22:07 +000011 };
12
13 template <int N> struct check_alignment {
14 typedef check<N == sizeof(X<N>)> t; // expected-note {{in instantiation}}
15 };
16
17 check_alignment<1>::t c1;
18 check_alignment<2>::t c2;
19 check_alignment<3>::t c3; // expected-note 2 {{in instantiation}}
20 check_alignment<4>::t c4;
21}