public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* trunk -D_GLIBCXX_DEBUG #include <regex> fails
@ 2021-08-09  9:50 Stephan Bergmann
  2021-08-09 10:05 ` Jonathan Wakely
  0 siblings, 1 reply; 7+ messages in thread
From: Stephan Bergmann @ 2021-08-09  9:50 UTC (permalink / raw)
  To: libstdc++, gcc-patches

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).

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
> +
>  #include <ext/aligned_buffer.h>
>  #include <ext/numeric_traits.h>
>  #include <bits/shared_ptr.h>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-10  7:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-09  9:50 trunk -D_GLIBCXX_DEBUG #include <regex> fails Stephan Bergmann
2021-08-09 10:05 ` Jonathan Wakely
2021-08-09 12:05   ` François Dumont
2021-08-09 14:27     ` Jonathan Wakely
2021-08-09 14:42       ` Jonathan Wakely
2021-08-09 19:47         ` Jonathan Wakely
2021-08-10  7:24         ` Stephan Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).