aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-06-09 11:27:01 -0400
committerJason Merrill <jason@gcc.gnu.org>2015-06-09 11:27:01 -0400
commit5af874fb6518ed3e21c1e0f750fac86788fdafa3 (patch)
tree9daa2e07f2106d90a2a2ea5325b24c470fbb6ef0 /gcc/cp
parentebcf592c841f47aa38ce0a9d95b4f04af975b0ac (diff)
downloadgcc-5af874fb6518ed3e21c1e0f750fac86788fdafa3.zip
gcc-5af874fb6518ed3e21c1e0f750fac86788fdafa3.tar.gz
gcc-5af874fb6518ed3e21c1e0f750fac86788fdafa3.tar.bz2
re PR c++/66387 (ICE in make_decl_rtl with lambda)
PR c++/66387 * semantics.c (process_outer_var_ref): Make sure the value is actually constant before returning it. * typeck.c (cp_build_array_ref): Allow subscripting non-lvalue array. From-SVN: r224287
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/semantics.c6
-rw-r--r--gcc/cp/typeck.c9
3 files changed, 13 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index bf48e96..089f693 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2015-06-09 Jason Merrill <jason@redhat.com>
+
+ PR c++/66387
+ * semantics.c (process_outer_var_ref): Make sure the value is
+ actually constant before returning it.
+ * typeck.c (cp_build_array_ref): Allow subscripting non-lvalue
+ array.
+
2015-06-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/65815
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 650ef4c..59ec9047 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3128,7 +3128,11 @@ process_outer_var_ref (tree decl, tsubst_flags_t complain)
form, so wait until instantiation time. */
return decl;
else if (decl_constant_var_p (decl))
- return scalar_constant_value (decl);
+ {
+ tree t = maybe_constant_value (convert_from_reference (decl));
+ if (TREE_CONSTANT (t))
+ return t;
+ }
}
if (parsing_nsdmi ())
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 6c4b038..5b09b73 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -3141,15 +3141,6 @@ cp_build_array_ref (location_t loc, tree array, tree idx,
return error_mark_node;
}
- if (!lvalue_p (array))
- {
- if (complain & tf_error)
- pedwarn (loc, OPT_Wpedantic,
- "ISO C++ forbids subscripting non-lvalue array");
- else
- return error_mark_node;
- }
-
/* Note in C++ it is valid to subscript a `register' array, since
it is valid to take the address of something with that
storage specification. */