diff options
author | Jason Merrill <jason@redhat.com> | 2014-06-03 11:39:20 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2014-06-03 11:39:20 -0400 |
commit | 093e62d2748c9664afa266364fb52cb683ab8a30 (patch) | |
tree | 27b9dd0edd0954ae416610d36214f2c0a36c28f3 /gcc | |
parent | 918621d3a8b84a6afda723f22e50b19ec305f77f (diff) | |
download | gcc-093e62d2748c9664afa266364fb52cb683ab8a30.zip gcc-093e62d2748c9664afa266364fb52cb683ab8a30.tar.gz gcc-093e62d2748c9664afa266364fb52cb683ab8a30.tar.bz2 |
re PR c++/60992 (ICE in tsubst_copy, at cp/pt.c:12637)
PR c++/60992
* pt.c (tsubst_copy) [VAR_DECL]: Try lookup first. Add a new
variable to local_specializations.
From-SVN: r211188
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 23 |
2 files changed, 19 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2ed9f15..f356caa 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2014-06-03 Jason Merrill <jason@redhat.com> + PR c++/60992 + * pt.c (tsubst_copy) [VAR_DECL]: Try lookup first. Add a new + variable to local_specializations. + PR c++/60848 * call.c (is_std_init_list): Check CLASSTYPE_TEMPLATE_INFO. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d267a5c..8858908 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12730,14 +12730,19 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) r = retrieve_local_specialization (t); if (r == NULL_TREE) { - if (DECL_ANON_UNION_VAR_P (t)) + /* First try name lookup to find the instantiation. */ + r = lookup_name (DECL_NAME (t)); + if (r) { - /* Just use name lookup to find a member alias for an - anonymous union, but then add it to the hash table. */ - r = lookup_name (DECL_NAME (t)); - gcc_assert (DECL_ANON_UNION_VAR_P (r)); - register_local_specialization (r, t); + /* Make sure that the one we found is the one we want. */ + tree ctx = tsubst (DECL_CONTEXT (t), args, + complain, in_decl); + if (ctx != DECL_CONTEXT (r)) + r = NULL_TREE; } + + if (r) + /* OK */; else { /* This can happen for a variable used in a @@ -12771,10 +12776,12 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) else if (decl_constant_var_p (r)) /* A use of a local constant decays to its value. FIXME update for core DR 696. */ - return integral_constant_value (r); + r = integral_constant_value (r); } - return r; } + /* Remember this for subsequent uses. */ + if (local_specializations) + register_local_specialization (r, t); } } else |