From e04737a5c748ee1a0313a935e20f05b7e0559244 Mon Sep 17 00:00:00 2001 From: jason Date: Fri, 3 Mar 2017 01:26:47 +0000 Subject: Allow deduction guides to look into primary template. * cp-tree.h (struct saved_scope): Add deduction_guide_type. (struct cp_decl_specifier_seq): Add constructor_p. * parser.c (cp_parser_decl_specifier_seq): Set constructor_p. (cp_parser_init_declarator): Check it. Set ctor_dtor_or_conv_p. Clear deduction_guide_type. Don't handle deduction guide names. (cp_parser_declarator): Don't clear ctor_dtor_or_conv_p. (cp_parser_direct_declarator): Likewise. Handle deduction guides. (cp_parser_member_declaration, cp_parser_cache_defarg) (cp_parser_objc_class_ivars): Set ctor_dtor_or_conv_p. * pt.c (tsubst_copy, tsubst_copy_and_build): Revert last change. (build_deduction_guide): Set deduction_guide_type. (dependent_scope_p): Check deduction_guide_type. * search.c (lookup_member): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245858 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/search.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/cp/search.c') diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 09c1b4e6456..6eb41243814 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1279,6 +1279,13 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type, if (tree t = currently_open_class (type)) type = t; + /* Declaration of a deduction guide can look inside the primary class + template; replace a compatible type with the real one. */ + if (cxx_dialect >= cxx1z + && scope_chain->deduction_guide_type + && same_type_p (type, scope_chain->deduction_guide_type)) + type = scope_chain->deduction_guide_type; + if (!basetype_path) basetype_path = TYPE_BINFO (type); -- cgit v1.2.1