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

* [Bug libstdc++/104098] [11/12 Regression] bits/stl_iterator.h fails to compile for __cplusplus > 201703L and with  __cpp_concepts undefined
  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 ` redi at gcc dot gnu.org
  2022-01-18 15:33 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2022-01-18 15:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.3
     Ever confirmed|0                           |1
      Known to work|                            |11.1.0
   Last reconfirmed|                            |2022-01-18
            Summary|bits/stl_iterator.h fails   |[11/12 Regression]
                   |to compile for __cplusplus  |bits/stl_iterator.h fails
                   |> 201703L and with          |to compile for __cplusplus
                   |__cpp_concepts undefined    |> 201703L and with
                   |                            |__cpp_concepts undefined
      Known to fail|                            |11.2.0, 12.0
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Is this an issue for a non-GCC tool with incomplete C++20 support?

The relevant commits are r12-946 on trunk and the r11-8540 backport.

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

* [Bug libstdc++/104098] [11/12 Regression] bits/stl_iterator.h fails to compile for __cplusplus > 201703L and with  __cpp_concepts undefined
  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
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2022-01-18 15:33 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think we should just change it to check __cpp_lib_concepts, which is only
true for C++20 anyway:

-#if __cplusplus <= 201703L
+#if ! __cpp_lib_concepts


That is the right condition for using __clamp_iter_cat, iter_value_t,
iter_difference_t and iter_reference_t.

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

* [Bug libstdc++/104098] [11/12 Regression] bits/stl_iterator.h fails to compile for __cplusplus > 201703L and with  __cpp_concepts undefined
  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
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: richard.corden at gmail dot com @ 2022-01-18 15:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Corden <richard.corden at gmail dot com> ---
(In reply to Jonathan Wakely from comment #1)
> Is this an issue for a non-GCC tool with incomplete C++20 support?
> 

It is yes.

Thanks for the quick reply.

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

* [Bug libstdc++/104098] [11/12 Regression] bits/stl_iterator.h fails to compile for __cplusplus > 201703L and with  __cpp_concepts undefined
  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
                   ` (2 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-18 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:e13e95bd274148a825bc9527efac49e99080dd64

commit r12-6692-ge13e95bd274148a825bc9527efac49e99080dd64
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jan 18 15:34:24 2022 +0000

    libstdc++: Use __cpp_lib_concepts in std::reverse_iterator [PR104098]

    We should not assume that std::iter_value_t etc. are defined
    unconditionally for C++20 mode.

    libstdc++-v3/ChangeLog:

            PR libstdc++/104098
            * include/bits/stl_iterator.h (reverse_iterator): Check
            __cpp_lib_concepts instead of __cplusplus.

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

* [Bug libstdc++/104098] [11/12 Regression] bits/stl_iterator.h fails to compile for __cplusplus > 201703L and with  __cpp_concepts undefined
  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
                   ` (3 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2022-01-18 16:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for trunk, backport to follow.

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

* [Bug libstdc++/104098] [11 Regression] bits/stl_iterator.h fails to compile for __cplusplus > 201703L and with  __cpp_concepts undefined
  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
                   ` (4 preceding siblings ...)
  2022-01-18 16:35 ` redi at gcc dot gnu.org
@ 2022-01-19 10:17 ` rguenth at gcc dot gnu.org
  2022-04-04 11:46 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-19 10:17 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug libstdc++/104098] [11 Regression] bits/stl_iterator.h fails to compile for __cplusplus > 201703L and with  __cpp_concepts undefined
  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
                   ` (5 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-04 11:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:f6bf63ff3684c28c3b2c4d3a67a42db738d6342d

commit r11-9764-gf6bf63ff3684c28c3b2c4d3a67a42db738d6342d
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jan 18 15:34:24 2022 +0000

    libstdc++: Use __cpp_lib_concepts in std::reverse_iterator [PR104098]

    We should not assume that std::iter_value_t etc. are defined
    unconditionally for C++20 mode.

    libstdc++-v3/ChangeLog:

            PR libstdc++/104098
            * include/bits/stl_iterator.h (reverse_iterator): Check
            __cpp_lib_concepts instead of __cplusplus.

    (cherry picked from commit e13e95bd274148a825bc9527efac49e99080dd64)

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

* [Bug libstdc++/104098] [11 Regression] bits/stl_iterator.h fails to compile for __cplusplus > 201703L and with  __cpp_concepts undefined
  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
                   ` (6 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2022-04-04 21:21 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 11.3

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

* [Bug libstdc++/104098] [11 Regression] bits/stl_iterator.h fails to compile for __cplusplus > 201703L and with  __cpp_concepts undefined
  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
                   ` (7 preceding siblings ...)
  2022-04-04 21:21 ` redi at gcc dot gnu.org
@ 2022-04-26 13:13 ` cvs-commit at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-26 13:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:5c8f58be95d666e08221447d43d84782e1e6fb95

commit r10-10578-g5c8f58be95d666e08221447d43d84782e1e6fb95
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jan 18 15:34:24 2022 +0000

    libstdc++: Use __cpp_lib_concepts in std::reverse_iterator [PR104098]

    We should not assume that std::iter_value_t etc. are defined
    unconditionally for C++20 mode.

    libstdc++-v3/ChangeLog:

            PR libstdc++/104098
            * include/bits/stl_iterator.h (reverse_iterator): Check
            __cpp_lib_concepts instead of __cplusplus.

    (cherry picked from commit e13e95bd274148a825bc9527efac49e99080dd64)

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