Hi,
this regression is an ICE on valid, and seems rather easy to analyze:
both apply_late_template_attributes and tsubst_attributes don't appear
to cope correctly with tsubst_attribute returning NULL_TREE. That, in
turn, seems normal for an empty pack - as in the testcases - given the
structure of the last part of the latter, handling PACK_EXPANSION_P
(val). I'm finishing testing on x86_64-linux (in libstdc++-v3, so far so
good).
Thanks, Paolo.
///////////////////
/cp
2018-02-26 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/84540
* pt.c (tsubst_attributes): Handle correctly tsubst_attribute
returning NULL_TREE.
(apply_late_template_attributes): Likewise.
/testsuite
2018-02-26 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/84540
* g++.dg/cpp0x/alignas14.C: New.
* g++.dg/cpp0x/alignas15.C: Likewise.
Index: cp/pt.c
===================================================================
--- cp/pt.c (revision 257989)
+++ cp/pt.c (working copy)
@@ -10245,9 +10245,8 @@ tsubst_attributes (tree attributes, tree args,
if (subst != t)
{
*p = subst;
- do
+ while (*p)
p = &TREE_CHAIN (*p);
- while (*p);
*p = TREE_CHAIN (t);
continue;
}
@@ -10314,9 +10313,8 @@ apply_late_template_attributes (tree *decl_p, tree
*p = TREE_CHAIN (t);
TREE_CHAIN (t) = NULL_TREE;
*q = tsubst_attribute (t, decl_p, args, complain, in_decl);
- do
+ while (*q)
q = &TREE_CHAIN (*q);
- while (*q);
}
else
p = &TREE_CHAIN (t);
Index: testsuite/g++.dg/cpp0x/alignas14.C
===================================================================
--- testsuite/g++.dg/cpp0x/alignas14.C (nonexistent)
+++ testsuite/g++.dg/cpp0x/alignas14.C (working copy)
@@ -0,0 +1,6 @@
+// PR c++/84540
+// { dg-do compile { target c++11 } }
+
+template<typename... T> struct alignas(alignof(T)...) A {};
+
+A<> a;
Index: testsuite/g++.dg/cpp0x/alignas15.C
===================================================================
--- testsuite/g++.dg/cpp0x/alignas15.C (nonexistent)
+++ testsuite/g++.dg/cpp0x/alignas15.C (working copy)
@@ -0,0 +1,6 @@
+// PR c++/84540
+// { dg-do compile { target c++11 } }
+
+template<typename... T> struct A { enum alignas(alignof(T)...) E {}; };
+
+A<> a;