Message ID | b01b0607-70ae-4371-9bb2-49d577d786fa@oracle.com |
---|---|
State | New |
Headers | show |
Series | [C++] PR 84540 ("[6/7/8 Regression] ICE with alignas in variadic template") | expand |
OK. On Mon, Feb 26, 2018 at 11:56 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote: > 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. > > /////////////////// >
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;