+2016-04-29 Dominik Vogt <vogt@linux.vnet.ibm.com>
+
+ PR/69089
+ * c-common.c (handle_aligned_attribute): Allow 0 as an argument to the
+ "aligned" attribute.
+
2016-04-28 Jason Merrill <jason@redhat.com>
* c-lex.c (c_common_has_attribute): Handle nodiscard.
else if (TYPE_P (*node))
type = node, is_type = 1;
- if ((i = check_user_alignment (align_expr, false)) == -1
+ if ((i = check_user_alignment (align_expr, true)) == -1
|| !check_cxx_fundamental_alignment_constraints (*node, i, flags))
*no_add_attrs = true;
else if (is_type)
+2016-04-29 Dominik Vogt <vogt@linux.vnet.ibm.com>
+
+ PR/69089
+ * g++.dg/cpp0x/alignas6.C: New test.
+
2016-04-29 Dominik Vogt <vogt@linux.vnet.ibm.com>
* gcc/testsuite/gcc.dg/cpp/mac-dir-2.c: Remove pointless duplicate
--- /dev/null
+// PR c++/69089
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wno-attributes" }
+
+alignas (0) int valid1;
+alignas (1 - 1) int valid2;
+struct Tvalid
+{
+ alignas (0) int i;
+ alignas (2 * 0) int j;
+};
+
+alignas (-1) int invalid1; /* { dg-error "not a positive power of 2" } */
+alignas (1 - 2) int invalid2; /* { dg-error "not a positive power of 2" } */
+struct Tinvalid
+{
+ alignas (-1) int i; /* { dg-error "not a positive power of 2" } */
+ alignas (2 * 0 - 1) int j; /* { dg-error "not a positive power of 2" } */
+};
+
+template <int N> struct TNvalid1 { alignas (N) int i; };
+TNvalid1<0> SNvalid1;
+template <int N> struct TNvalid2 { alignas (N) int i; };
+TNvalid2<1 - 1> SNvalid2;
+
+template <int N> struct TNinvalid1 { alignas (N) int i; }; /* { dg-error "not a positive power of 2" } */
+TNinvalid1<-1> SNinvalid1;
+template <int N> struct TNinvalid2 { alignas (N) int i; }; /* { dg-error "not a positive power of 2" } */
+TNinvalid2<1 - 2> SNinvalid2;