public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Stephan Bergmann <sbergman@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: trunk -D_GLIBCXX_DEBUG #include <regex> fails
Date: Mon, 9 Aug 2021 11:50:38 +0200	[thread overview]
Message-ID: <7f94ec40-6cec-59c1-2281-066e1a15c267@redhat.com> (raw)

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>


             reply	other threads:[~2021-08-09  9:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-09  9:50 Stephan Bergmann [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f94ec40-6cec-59c1-2281-066e1a15c267@redhat.com \
    --to=sbergman@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).