summaryrefslogtreecommitdiff
path: root/gcc/cp/search.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2017-03-03 01:26:47 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2017-03-03 01:26:47 +0000
commite04737a5c748ee1a0313a935e20f05b7e0559244 (patch)
tree7796627e11773e9ec963e179bdf219f300279c3e /gcc/cp/search.c
parent66c2be641474f128b4a84b412ad3547bc545c660 (diff)
downloadgcc-e04737a5c748ee1a0313a935e20f05b7e0559244.tar.gz
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
Diffstat (limited to 'gcc/cp/search.c')
-rw-r--r--gcc/cp/search.c7
1 files changed, 7 insertions, 0 deletions
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);