aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Liska <marxin@gcc.gnu.org>2016-11-24 11:26:12 +0000
committerMartin Liska <marxin@gcc.gnu.org>2016-11-24 11:26:12 +0000
commitbf2df7a9b39897740e6b2fc8c03b1b195748c98f (patch)
treed7ecca64a0d573aae0f2467ce321f213a81c21be /gcc
parentadf86091b134fdfa5aadfd3d2b375f63a50d4ca8 (diff)
downloadgcc-bf2df7a9b39897740e6b2fc8c03b1b195748c98f.zip
gcc-bf2df7a9b39897740e6b2fc8c03b1b195748c98f.tar.gz
gcc-bf2df7a9b39897740e6b2fc8c03b1b195748c98f.tar.bz2
cp_parser_range_for: use safe_push instead of quick_push (PR
PR bootstrap/78493 * parser.c (cp_parser_range_for): Use safe_push instead of quick_push. PR bootstrap/78493 * g++.dg/cpp1z/decomp18.C: New test. From-SVN: r242828
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/parser.c8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp18.C12
4 files changed, 26 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1386d4ef..20b356f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-24 Martin Liska <mliska@suse.cz>
+
+ PR bootstrap/78493
+ * parser.c (cp_parser_range_for): Use safe_push instead of quick_push.
+
2016-11-23 Jakub Jelinek <jakub@redhat.com>
PR c++/77907
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 9da4b30..843cbe2 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -11503,8 +11503,8 @@ cp_parser_range_for (cp_parser *parser, tree scope, tree init, tree range_decl,
for (unsigned int i = 0; i < decomp_cnt; i++, d = DECL_CHAIN (d))
{
tree name = DECL_NAME (d);
- names.quick_push (name);
- bindings.quick_push (IDENTIFIER_BINDING (name));
+ names.safe_push (name);
+ bindings.safe_push (IDENTIFIER_BINDING (name));
IDENTIFIER_BINDING (name)
= IDENTIFIER_BINDING (name)->previous;
}
@@ -11513,8 +11513,8 @@ cp_parser_range_for (cp_parser *parser, tree scope, tree init, tree range_decl,
if (names.is_empty ())
{
tree name = DECL_NAME (range_decl);
- names.quick_push (name);
- bindings.quick_push (IDENTIFIER_BINDING (name));
+ names.safe_push (name);
+ bindings.safe_push (IDENTIFIER_BINDING (name));
IDENTIFIER_BINDING (name) = IDENTIFIER_BINDING (name)->previous;
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a6e7146..99412e2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR bootstrap/78493
+ * g++.dg/cpp1z/decomp18.C: New test.
+
2016-11-23 Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com>
* gcc.target/aarch64/ldp_stp_1.c : Add -mcpu=generic.
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp18.C b/gcc/testsuite/g++.dg/cpp1z/decomp18.C
new file mode 100644
index 0000000..d5c68a2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp18.C
@@ -0,0 +1,12 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+struct A { char a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r; } a[64];
+
+void
+foo ()
+{
+ int z = 0;
+ for (auto & [ b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s ] : a) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ z += b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r + s;
+}