summaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/semantics.cc')
-rw-r--r--gcc/cp/semantics.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index ab48f11c9be..972a1966f69 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -1398,6 +1398,11 @@ finish_for_stmt (tree for_stmt)
add_stmt (do_poplevel (scope));
+ /* If we're being called from build_vec_init, don't mess with the names of
+ the variables for an enclosing range-for. */
+ if (!stmts_are_full_exprs_p ())
+ return;
+
for (int i = 0; i < 3; i++)
if (range_for_decl[i])
DECL_NAME (range_for_decl[i])