From cf4763bd7283cf8dbfabbf5e9bd929b67a4e5186 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 14 Jun 2018 21:07:14 +0000 Subject: [PATCH] re PR c++/86063 (g++ ICE at tree check: expected tree_list, have expr_pack_expansion in cp_check_const_attributes, at cp/decl2.c:1391) PR c++/86063 * decl2.c (cp_check_const_attributes): Skip trees that are not TREE_LISTs. * g++.dg/cpp0x/gen-attrs-65.C: New test. From-SVN: r261613 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl2.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/gen-attrs-65.C | 7 +++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/gen-attrs-65.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dd9b7dba102..f465dae12c0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-06-14 Marek Polacek + + PR c++/86063 + * decl2.c (cp_check_const_attributes): Skip trees that are not + TREE_LISTs. + 2018-06-14 Jakub Jelinek P0624R2 - Default constructible and assignable stateless lambdas diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 8917880ba64..5fc6369d39d 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1387,7 +1387,8 @@ cp_check_const_attributes (tree attributes) for (attr = attributes; attr; attr = TREE_CHAIN (attr)) { tree arg; - for (arg = TREE_VALUE (attr); arg; arg = TREE_CHAIN (arg)) + for (arg = TREE_VALUE (attr); arg && TREE_CODE (arg) == TREE_LIST; + arg = TREE_CHAIN (arg)) { tree expr = TREE_VALUE (arg); if (EXPR_P (expr)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f060c6eb927..94c4fcaa11f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-06-14 Marek Polacek + + PR c++/86063 + * g++.dg/cpp0x/gen-attrs-65.C: New test. + 2018-06-14 Jakub Jelinek PR target/86048 diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-65.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-65.C new file mode 100644 index 00000000000..1d2b2f04e7a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-65.C @@ -0,0 +1,7 @@ +// PR c++/86063 +// { dg-do compile { target c++11 } } + +template +struct S { + [[foobar(alignof(T))...]] char t; // { dg-warning "attribute directive ignored" } +}; -- 2.30.2