aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2020-02-25 13:37:18 -0500
committerJason Merrill <jason@redhat.com>2020-02-25 23:35:45 -0500
commita57528b33be33d4428ac62901d04cf39807d624e (patch)
tree1d2d37bf29ed45ef4c2b1923a99aa75bde0b78cb /gcc/cp
parent3d99aab56d7237bb8260653ed07ca8b182fbf975 (diff)
downloadgcc-a57528b33be33d4428ac62901d04cf39807d624e.zip
gcc-a57528b33be33d4428ac62901d04cf39807d624e.tar.gz
gcc-a57528b33be33d4428ac62901d04cf39807d624e.tar.bz2
PR c++/87554 - ICE with extern template and reference member.
The removed code ended up setting DECL_INITIAL to the INIT_EXPR returned by split_nonconstant_init, which makes no sense. This code was added back in 1996, so any rationale is long lost. gcc/cp/ChangeLog 2020-02-25 Jason Merrill <jason@redhat.com> PR c++/87554 - ICE with extern template and reference member. * decl.c (cp_finish_decl): Don't set DECL_INITIAL of external vars.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c3
2 files changed, 6 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f070889..3480403 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2020-02-25 Jason Merrill <jason@redhat.com>
+
+ PR c++/87554 - ICE with extern template and reference member.
+ * decl.c (cp_finish_decl): Don't set DECL_INITIAL of external vars.
+
2020-02-25 Alexandre Oliva <aoliva@redhat.com>
PR c++/86747
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 6dc23ec3..5642791 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7301,8 +7301,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
&& ! (DECL_LANG_SPECIFIC (decl)
&& DECL_NOT_REALLY_EXTERN (decl)))
{
- if (init)
- DECL_INITIAL (decl) = init;
+ /* check_initializer will have done any constant initialization. */
}
/* A variable definition. */
else if (DECL_FUNCTION_SCOPE_P (decl) && !TREE_STATIC (decl))