1 // PR c++/69089 2 // { dg-do compile { target c++11 } } 3 // { dg-options "-Wno-attributes" } 4 5 alignas (0) int valid1; 6 alignas (1 - 1) int valid2; 7 struct Tvalid 8 { 9 alignas (0) int i; 10 alignas (2 * 0) int j; 11 }; 12 13 alignas (-1) int invalid1; /* { dg-error "not a positive power of 2" } */ 14 alignas (1 - 2) int invalid2; /* { dg-error "not a positive power of 2" } */ 15 struct Tinvalid 16 { 17 alignas (-1) int i; /* { dg-error "not a positive power of 2" } */ 18 alignas (2 * 0 - 1) int j; /* { dg-error "not a positive power of 2" } */ 19 }; 20 21 template <int N> struct TNvalid1 { alignas (N) int i; }; 22 TNvalid1<0> SNvalid1; 23 template <int N> struct TNvalid2 { alignas (N) int i; }; 24 TNvalid2<1 - 1> SNvalid2; 25 26 template <int N> struct TNinvalid1 { alignas (N) int i; }; /* { dg-error "not a positive power of 2" } */ 27 TNinvalid1<-1> SNinvalid1; 28 template <int N> struct TNinvalid2 { alignas (N) int i; }; /* { dg-error "not a positive power of 2" } */ 29 TNinvalid2<1 - 2> SNinvalid2; 30