aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/typeck2.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-11-16 17:42:24 -0500
committerJason Merrill <jason@gcc.gnu.org>2016-11-16 17:42:24 -0500
commit46b2baa723df876837763f269717413d04a226e0 (patch)
treef3a4b93a42b0d4a6d52610ed1b0c016684d17afc /gcc/cp/typeck2.c
parent2ec15cba58bfe91bf91c536f5360c05a5b12794a (diff)
downloadgcc-46b2baa723df876837763f269717413d04a226e0.zip
gcc-46b2baa723df876837763f269717413d04a226e0.tar.gz
gcc-46b2baa723df876837763f269717413d04a226e0.tar.bz2
PR c++/78373 - ICE with TREE_CONSTANT reference
* decl.c (cp_finish_decl): Don't set TREE_CONSTANT on a reference. * typeck2.c (store_init_value): Likewise. From-SVN: r242523
Diffstat (limited to 'gcc/cp/typeck2.c')
-rw-r--r--gcc/cp/typeck2.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 022a478..2ca4bf2 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -824,7 +824,9 @@ store_init_value (tree decl, tree init, vec<tree, va_gc>** cleanups, int flags)
const_init = (reduced_constant_expression_p (value)
|| error_operand_p (value));
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl) = const_init;
- TREE_CONSTANT (decl) = const_init && decl_maybe_constant_var_p (decl);
+ /* FIXME setting TREE_CONSTANT on refs breaks the back end. */
+ if (TREE_CODE (type) != REFERENCE_TYPE)
+ TREE_CONSTANT (decl) = const_init && decl_maybe_constant_var_p (decl);
}
value = cp_fully_fold (value);