aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/search.c
diff options
context:
space:
mode:
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 09c1b4e..6eb4124 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);