aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-08-29 15:40:08 -0400
committerJason Merrill <jason@gcc.gnu.org>2017-08-29 15:40:08 -0400
commit12659e10c78200717fc82ed77892de5059fa44b5 (patch)
treec3ed1339329a54953fe39b9f37ba918d7b6880c7 /gcc/cp/parser.c
parent1aeafba210c4796bde79d4d06e05c96a153b8fb5 (diff)
downloadgcc-12659e10c78200717fc82ed77892de5059fa44b5.zip
gcc-12659e10c78200717fc82ed77892de5059fa44b5.tar.gz
gcc-12659e10c78200717fc82ed77892de5059fa44b5.tar.bz2
Instantiate default arguments/member initializers once.
* init.c (get_nsdmi): Remember NSDMI instantiations. * parser.c (inject_this_parameter): Be more picky about current_class_ptr. * pt.c (tsubst_copy): Simplify 'this' handling. (tsubst_default_argument): Remember default argument instantiations. Take parameter number. (tsubst_default_arguments): Pass it. * call.c (convert_default_arg): Likewise. From-SVN: r251422
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 9b7c2c0..d66f146 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -20715,7 +20715,9 @@ inject_this_parameter (tree ctype, cp_cv_quals quals)
{
/* We don't clear this between NSDMIs. Is it already what we want? */
tree type = TREE_TYPE (TREE_TYPE (current_class_ptr));
- if (same_type_ignoring_top_level_qualifiers_p (ctype, type)
+ if (DECL_P (current_class_ptr)
+ && DECL_CONTEXT (current_class_ptr) == NULL_TREE
+ && same_type_ignoring_top_level_qualifiers_p (ctype, type)
&& cp_type_quals (type) == quals)
return;
}