+2017-02-22 Marek Polacek <polacek@redhat.com>
+
+ PR c++/79653
+ * parser.c (cp_parser_std_attribute_spec): Don't build the attribute
+ if the alignas expression is erroneous.
+ * pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return
+ error_mark_node.
+
2017-02-21 Jason Merrill <jason@redhat.com>
PR c++/50308 - wrong deprecated warning with ADL
alignas_expr = cxx_alignas_expr (alignas_expr);
alignas_expr = build_tree_list (NULL_TREE, alignas_expr);
+ /* Handle alignas (pack...). */
if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS))
{
cp_lexer_consume_token (parser->lexer);
alignas_expr = make_pack_expansion (alignas_expr);
}
+ /* Something went wrong, so don't build the attribute. */
+ if (alignas_expr == error_mark_node)
+ return error_mark_node;
+
if (cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN) == NULL)
{
cp_parser_error (parser, "expected %<)%>");
/* An attribute pack expansion. */
tree purp = TREE_PURPOSE (t);
tree pack = tsubst_pack_expansion (val, args, complain, in_decl);
+ if (pack == error_mark_node)
+ return error_mark_node;
int len = TREE_VEC_LENGTH (pack);
tree list = NULL_TREE;
tree *q = &list;
+2017-02-22 Marek Polacek <polacek@redhat.com>
+
+ PR c++/79653
+ * g++.dg/cpp0x/alignas10.C: New test.
+ * g++.dg/cpp0x/alignas9.C: New test.
+
2017-02-22 Jakub Jelinek <jakub@redhat.com>
PR target/70465
--- /dev/null
+// PR c++/79653
+// { dg-do compile { target c++11 } }
+
+template <typename... A> struct outer {
+ template <typename... B> struct alignas(alignof(A) * alignof(B)...) inner {}; // { dg-error "mismatched argument pack lengths" }
+};
+outer<int>::inner<> mismatched_packs;
--- /dev/null
+// PR c++/79653
+// { dg-do compile { target c++11 } }
+
+template <typename... T>
+struct A { alignas(int...) char c; }; // { dg-error "no argument packs|expected" }
+A<int, double> a;