On Fri, 24 Oct 2025 at 14:55, Eric Pimentel Aguiar
<[email protected]> wrote:
>
> Hi,
>
> This is my first patch to the GCC mailing, so feedback is appreciated. I
> may have gone overboard with detail for a mere four-line change. I
> noticed trunk builds of libstdc++ broke previously working builds of an
> experimental C++ codebase of mine that tests new C++26 features. The
> problem can be replicated by compiling the file main.cc containing:
>
> import std;
> int main() {}
>
> with:
>
> $ g++ -std=c++26 -fmodules -fsearch-include-path bits/std.cc main.cc
>
> I didn't see any reports of this on the bug tracker, so no PR is
> referenced.
Thanks for the patch! This looks obviously correct and so is approved
for trunk (the change is not legally significant so we don't need to
worry about copyright assignment or a DCO sign-off). Somebody will
push this for you soon.
>
> -- >8 --
>
> When exporting declarations in a namespace with using declarations, the
> name must be fully qualified. Recently introduced std::full_extent{,_t},
> std:strided_slice, and std::submdspan_mapping_result broke module std
> and module std.compat.
>
> No testcase could be added to the testsuite, as current testing
> machinery cannot control the order in which the files are compiled. To
> be able to compile a file importing the std module in a single compiler
> invocation, the importing file must be named after the file containing
> module std, i.e., this works:
>
> $ g++ -std=c++23 -fmodules -fsearch-include-path bits/std.cc importer.cc
>
> while this does not:
>
> $ g++ -std=c++23 -fmodules -fsearch-include-path importer.cc bits/std.cc
>
> so the dg-options test directive is not enough, as it is unspecified in
> what order they will be added to the compile line.
>
> The dg-additional-sources directive cannot be used either, as it is
> stated in the GCC Internals manual that such added sources will appear in
> the compile line _following_ the main test file. Until the proper
> functionality is added to the testsuite to handle modules, changes to the
> std and std.compat modules should be manually verified to not break the
> them.
>
> libstdc++-v3/ChangeLog:
>
> * include/bits/std.cc.in: Fix <mdspan> exports
> ---
> libstdc++-v3/src/c++23/std.cc.in | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libstdc++-v3/src/c++23/std.cc.in
> b/libstdc++-v3/src/c++23/std.cc.in
> index e849307f186..4c11b1bf711 100644
> --- a/libstdc++-v3/src/c++23/std.cc.in
> +++ b/libstdc++-v3/src/c++23/std.cc.in
> @@ -1872,10 +1872,10 @@ export namespace std
> #if __glibcxx_padded_layouts
> using std::layout_left_padded;
> using std::layout_right_padded;
> - using strided_slice;
> - using full_extent_t;
> - using full_extent;
> - using submdspan_mapping_result;
> + using std::strided_slice;
> + using std::full_extent_t;
> + using std::full_extent;
> + using std::submdspan_mapping_result;
> #endif
> // FIXME submdspan_extents, mdsubspan
> }
> --
> 2.51.1
>