On Mon, 9 Aug 2021 at 15:42, Jonathan Wakely <jwak...@redhat.com> wrote: > > On Mon, 9 Aug 2021 at 15:27, Jonathan Wakely wrote: > > > > On Mon, 9 Aug 2021 at 13:05, François Dumont via Libstdc++ > > <libstd...@gcc.gnu.org> wrote: > > > > > > On 09/08/21 12:05 pm, Jonathan Wakely via Libstdc++ wrote: > > > > On Mon, 9 Aug 2021 at 10:51, Stephan Bergmann via Libstdc++ > > > > <libstd...@gcc.gnu.org> wrote: > > > >> Not sure why I started to experience this now with a recent > > > >> GCC/libstdc++ trunk build: > > > >> > > > >>> $ cat test.cc > > > >>> #include <regex> > > > >>> $ gcc/trunk/inst/bin/g++ -D_GLIBCXX_DEBUG -fsyntax-only test.cc > > > >>> In file included from > > > >>> /home/sbergman/gcc/trunk/inst/include/c++/12.0.0/bits/regex_automaton.h:401, > > > >>> from > > > >>> /home/sbergman/gcc/trunk/inst/include/c++/12.0.0/regex:60, > > > >>> from test.cc:1: > > > >>> /home/sbergman/gcc/trunk/inst/include/c++/12.0.0/bits/regex_automaton.tcc: > > > >>> In member function ‘std::__detail::_StateSeq<_TraitsT> > > > >>> std::__detail::_StateSeq<_TraitsT>::_M_clone()’: > > > >>> /home/sbergman/gcc/trunk/inst/include/c++/12.0.0/bits/regex_automaton.tcc:197:12: > > > >>> error: ‘map’ is not a member of ‘std’ > > > >>> 197 | std::map<_StateIdT, _StateIdT> __m; > > > >>> | ^~~ > > > >> [...] > > > >>> In file included from > > > >>> /home/sbergman/gcc/trunk/inst/include/c++/12.0.0/regex:62, > > > >>> from test.cc:1: > > > >>> /home/sbergman/gcc/trunk/inst/include/c++/12.0.0/bits/regex_compiler.h: > > > >>> At global scope: > > > >>> /home/sbergman/gcc/trunk/inst/include/c++/12.0.0/bits/regex_compiler.h:541:12: > > > >>> error: ‘vector’ in namespace ‘std’ does not name a template type > > > >>> 541 | std::vector<_CharT> _M_char_set; > > > >>> | ^~~~~~ > > > >> [...] > > > >> > > > >> where neither the use of std::map in bits/regex_automaton.tcc nor the > > > >> use of std::vector in bits/regex_compiler.h are in _GLIBCXX_DEBUG-only > > > >> code (but compiling without -D_GLIBCXX_DEBUG succeeded). > > > > With that flag the container implementations are defined in namespace > > > > __gnu_cxx1998, and std::map is supposed to refer to __gnu_debug::map. > > > > But the debug map is declared in a header which isn't included by > > > > <regex> since I replaced <map> with <bits/stl_map.h>. > > > > > > > > > > > > > > > >> Anyway, what would apparently fix it for me is > > > >> > > > >>> diff --git a/libstdc++-v3/include/std/regex > > > >>> b/libstdc++-v3/include/std/regex > > > >>> index 04fb8b2d971..29fd2956fd0 100644 > > > >>> --- a/libstdc++-v3/include/std/regex > > > >>> +++ b/libstdc++-v3/include/std/regex > > > >>> @@ -42,6 +42,11 @@ > > > >>> #include <stdexcept> > > > >>> #include <string> > > > >>> > > > >>> +#if defined _GLIBCXX_DEBUG > > > >>> +#include <map> > > > >>> +#include <vector> > > > >>> +#endif > > > >>> + > > > > I think we can do this instead: > > > > > > > > --- a/libstdc++-v3/include/std/regex > > > > +++ b/libstdc++-v3/include/std/regex > > > > @@ -63,6 +63,11 @@ > > > > #include <bits/regex.h> > > > > #include <bits/regex_executor.h> > > > > > > > > +#ifdef _GLIBCXX_DEBUG > > > > +# include <debug/map> > > > > +# include <debug/vector> > > > > +#endif > > > > + > > > > #if __cplusplus >= 201703L && _GLIBCXX_USE_CXX11_ABI > > > > namespace std _GLIBCXX_VISIBILITY(default) > > > > { > > > > > > > > > > > > I'll test it, thanks for the report. > > > > > > > We are confident about the usage of those containers in the regex > > > implementation, aren't we ? > > > > > > You can normally avoid the includes if you use for example > > > _GLIBCXX_STD_C::map rather than std::map. > > > > Yes, I have a patch to do that. > > This is what I'm testing.
Pushed to trunk now.