aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/iresolve.cc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2024-11-20 23:46:54 +0100
committerJason Merrill <jason@redhat.com>2025-05-28 09:01:47 -0400
commit06b9c58c70a4fee7cc680aaeb5790aaadbb9fc77 (patch)
treea5e3a87ab237a5b5f7743b411774bc89431dcb28 /gcc/fortran/iresolve.cc
parentd4a2f9ba6ece32fb8500f10204fcf409aa26fbfb (diff)
downloadgcc-06b9c58c70a4fee7cc680aaeb5790aaadbb9fc77.zip
gcc-06b9c58c70a4fee7cc680aaeb5790aaadbb9fc77.tar.gz
gcc-06b9c58c70a4fee7cc680aaeb5790aaadbb9fc77.tar.bz2
c++: modules and using-directives
We weren't representing 'using namespace' at all in modules, which broke some of the <chrono> literals tests. This only represents exported using-declarations; others should be irrelevant to importers, as any name lookup in the imported module that would have cared about them was done while compiling the header unit. I experimented with various approaches to representing them; this patch handles them in read/write_namespaces, after the namespaces themselves. I spent a while pondering how to deal with the depset code in order to connect them, but then realized it would be simpler to refer to them based on their index in the array of namespaces. Any using-directives from an indirect import are ignored, so in an export import, any imported using-directives are exported again. gcc/cp/ChangeLog: * module.cc (module_state::write_namespaces): Write using-directives. (module_state::read_namespaces): And read them. * name-lookup.cc (add_using_namespace): Add overload. Build a USING_DECL for modules. (name_lookup::search_usings, name_lookup::queue_usings) (using_directives_contain_std_p): Strip the USING_DECL. * name-lookup.h: Declare it. * parser.cc (cp_parser_import_declaration): Set MK_EXPORTING for export import. gcc/testsuite/ChangeLog: * g++.dg/modules/namespace-8_a.C: New test. * g++.dg/modules/namespace-8_b.C: New test. * g++.dg/modules/namespace-9_a.C: New test. * g++.dg/modules/namespace-9_b.C: New test. * g++.dg/modules/namespace-10_a.C: New test. * g++.dg/modules/namespace-10_b.C: New test. * g++.dg/modules/namespace-10_c.C: New test. * g++.dg/modules/namespace-11_a.C: New test. * g++.dg/modules/namespace-11_b.C: New test. * g++.dg/modules/namespace-11_c.C: New test.
Diffstat (limited to 'gcc/fortran/iresolve.cc')
0 files changed, 0 insertions, 0 deletions