public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/104098] New: bits/stl_iterator.h fails to compile for __cplusplus > 201703L but with  __cpp_concepts undefined
@ 2022-01-18 15:10 richard.corden at gmail dot com
  2022-01-18 15:29 ` [Bug libstdc++/104098] [11/12 Regression] bits/stl_iterator.h fails to compile for __cplusplus > 201703L and " redi at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: richard.corden at gmail dot com @ 2022-01-18 15:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104098

            Bug ID: 104098
           Summary: bits/stl_iterator.h fails to compile for __cplusplus >
                    201703L but with  __cpp_concepts undefined
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: richard.corden at gmail dot com
  Target Milestone: ---

Hi,

The following commit changed a preprocessor condition, removing a check for
__cpp_lib_concepts:

 
https://github.com/gcc-mirror/gcc/commit/d5cbe0f0d4b7bc11f80b2236521f90ec94e95767#diff-d1fe6b9164baa7e8e1119a4d194b6b2481439be0cdf5da5794e8001537db4e84


The result being that this header cannot be used with __cplusplus after 201703L
unless "__cpp_concepts" is defined.

Compiling the following with "g++ -std=c++20 sample.cpp" reproduces the issue:

{code:c++}
  // sample.cpp
  #undef __cpp_concepts
  #include <vector>
{code}

{noformat}
> g++-11 -std=c++20 sample.cpp

In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/vector:60,
                 from sample.cpp:3:
/usr/include/c++/11/bits/stl_iterator.h:158:25: error: ‘random_access_iterator’
was not declared in this scope; did you mean ‘random_access_iterator_tag’?
  158 |         = conditional_t<random_access_iterator<_Iterator>,
      |                         ^~~~~~~~~~~~~~~~~~~~~~
      |                         random_access_iterator_tag
/usr/include/c++/11/bits/stl_iterator.h:158:57: error: wrong number of template
arguments (1, should be 3)
  158 |         = conditional_t<random_access_iterator<_Iterator>,
      |                                                         ^
In file included from /usr/include/c++/11/bits/move.h:57,
                 from /usr/include/c++/11/bits/stl_pair.h:59,
                 from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/vector:60,
                 from sample.cpp:3:
{noformat}


The following addresses the issue for me locally:
{code:c++}
#if __cplusplus <= 201703L || ! defined (__cpp_lib_concepts)
{code}


Cheers,


Richard

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

end of thread, other threads:[~2022-04-26 13:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18 15:10 [Bug libstdc++/104098] New: bits/stl_iterator.h fails to compile for __cplusplus > 201703L but with __cpp_concepts undefined richard.corden at gmail dot com
2022-01-18 15:29 ` [Bug libstdc++/104098] [11/12 Regression] bits/stl_iterator.h fails to compile for __cplusplus > 201703L and " redi at gcc dot gnu.org
2022-01-18 15:33 ` redi at gcc dot gnu.org
2022-01-18 15:55 ` richard.corden at gmail dot com
2022-01-18 16:32 ` cvs-commit at gcc dot gnu.org
2022-01-18 16:35 ` redi at gcc dot gnu.org
2022-01-19 10:17 ` [Bug libstdc++/104098] [11 " rguenth at gcc dot gnu.org
2022-04-04 11:46 ` cvs-commit at gcc dot gnu.org
2022-04-04 21:21 ` redi at gcc dot gnu.org
2022-04-26 13:13 ` cvs-commit at gcc dot gnu.org

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