re PR c++/86063 (g++ ICE at tree check: expected tree_list, have expr_pack_expansion...
authorMarek Polacek <polacek@redhat.com>
Thu, 14 Jun 2018 21:07:14 +0000 (21:07 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 14 Jun 2018 21:07:14 +0000 (21:07 +0000)
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
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/gen-attrs-65.C [new file with mode: 0644]

index dd9b7dba10217f323ef09f7693d3421ec85ba15d..f465dae12c063ed6ad3bec55cc38bb3b3de9e4bc 100644 (file)
@@ -1,3 +1,9 @@
+2018-06-14  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/86063
+       * decl2.c (cp_check_const_attributes): Skip trees that are not
+       TREE_LISTs.
+
 2018-06-14  Jakub Jelinek  <jakub@redhat.com>
 
        P0624R2 - Default constructible and assignable stateless lambdas
index 8917880ba6494fc150245d84c987076d48ff8a99..5fc6369d39d93d5607ad1be5cd2dfbe784425ac0 100644 (file)
@@ -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))
index f060c6eb927e842e7543a4f7e73a94eba7cf0222..94c4fcaa11f6e5c3c29bce2aecce866d7c47c11c 100644 (file)
@@ -1,3 +1,8 @@
+2018-06-14  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/86063
+       * g++.dg/cpp0x/gen-attrs-65.C: New test.
+
 2018-06-14  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..1d2b2f0
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/86063
+// { dg-do compile { target c++11 } }
+
+template <class... T>
+struct S {
+  [[foobar(alignof(T))...]] char t; // { dg-warning "attribute directive ignored" }
+};