Skip to content
Snippets Groups Projects
Commit 6f115a8e authored by Nathaniel Shead's avatar Nathaniel Shead
Browse files

c++/modules: Handle transitive reachability for deduction guides [PR116403]


Currently we implement [temp.deduct.guide] p1 by forcing all deduction
guides to be considered as exported.  However this is not sufficient:
for transitive non-exported imports we will still hide the deduction
guide from name lookup, causing errors.

This patch instead adjusts name lookup to have a new ANY_REACHABLE flag
to allow for this case.  Currently this is only used by deduction guides
but there are some other circumstances where this may be useful in the
future (e.g. finding existing temploid friends).

	PR c++/116403

gcc/cp/ChangeLog:

	* pt.cc (deduction_guides_for): Use ANY_REACHABLE for lookup of
	deduction guides.
	* module.cc (depset::hash::add_deduction_guides): Likewise.
	(module_state::write_cluster): No longer override deduction
	guides as exported.
	* name-lookup.cc (name_lookup::search_namespace_only): Ignore
	visibility when LOOK_want::ANY_REACHABLE is specified.
	(check_module_override): Ignore visibility when checking for
	ambiguating deduction guides.
	* name-lookup.h (LOOK_want): New flag 'ANY_REACHABLE'.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/dguide-4_a.C: New test.
	* g++.dg/modules/dguide-4_b.C: New test.
	* g++.dg/modules/dguide-4_c.C: New test.

Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: default avatarJason Merrill <jason@redhat.com>
parent 0b7904e2
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment