aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr85015.C12
4 files changed, 20 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 619161b..52af546 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2018-03-23 Jakub Jelinek <jakub@redhat.com>
+ PR c++/85015
+ * decl.c (compute_array_index_type): Set osize to mark_rvalue_use
+ result.
+
PR c++/84942
* pt.c (tsubst_copy_and_build) <case FIX_TRUNC_EXPR>: Replace
cp_build_unary_op call with gcc_unreachable ().
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 0aa4ac2..96d4b72 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -9520,7 +9520,7 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
if (!type_dependent_expression_p (size))
{
- size = mark_rvalue_use (size);
+ osize = size = mark_rvalue_use (size);
if (cxx_dialect < cxx11 && TREE_CODE (size) == NOP_EXPR
&& TREE_SIDE_EFFECTS (size))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 419bd56..99696f3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2018-03-23 Jakub Jelinek <jakub@redhat.com>
+ PR c++/85015
+ * g++.dg/cpp0x/pr85015.C: New test.
+
PR c++/84942
* g++.dg/cpp1y/pr84942.C: New test.
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr85015.C b/gcc/testsuite/g++.dg/cpp0x/pr85015.C
new file mode 100644
index 0000000..38dc7cb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr85015.C
@@ -0,0 +1,12 @@
+// PR c++/85015
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+void
+foo ()
+{
+ int &&c = v + 1; // { dg-error "was not declared in this scope" }
+ struct S { // { dg-message "declared here" "" { target *-*-* } .-1 }
+ void bar () { int a[c]; } // { dg-error "use of local variable with automatic storage from containing function" }
+ } e;
+}