public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/112796] New: <algorithm> header implicitly includes <concepts>
@ 2023-11-30 23:33 bill.trost at harmonicinc dot com
  2023-12-01 13:21 ` [Bug libstdc++/112796] " redi at gcc dot gnu.org
  2023-12-01 13:28 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: bill.trost at harmonicinc dot com @ 2023-11-30 23:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112796
           Summary: <algorithm> header implicitly includes <concepts>
           Product: gcc
           Version: 12.2.0
               URL: https://godbolt.org/z/Pra17xczj
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bill.trost at harmonicinc dot com
  Target Milestone: ---
            Target: x86-64

Created attachment 56739
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56739&action=edit
Sample code that incorrectly compiles.

The attached code should not compile (and does not compile if you don't include
<algorithm>). It should have to #include <concepts>.

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

* [Bug libstdc++/112796] <algorithm> header implicitly includes <concepts>
  2023-11-30 23:33 [Bug libstdc++/112796] New: <algorithm> header implicitly includes <concepts> bill.trost at harmonicinc dot com
@ 2023-12-01 13:21 ` redi at gcc dot gnu.org
  2023-12-01 13:28 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2023-12-01 13:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is not a bug in GCC, the C++ standard allows any header to include any
other. The bug is in your code, and we can't generally diagnose it.

It's simply not possible to implement <algorithm> without at least some of the
concepts defined in <concepts>, because the algos are specified in terms of
those concepts.

Similarly, nearly every header includes the <type_traits> header.

While it would be nice if we didn't expose all of <concepts> for any program
that doesn't include it explicitly, that's just not practical, sorry.

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

* [Bug libstdc++/112796] <algorithm> header implicitly includes <concepts>
  2023-11-30 23:33 [Bug libstdc++/112796] New: <algorithm> header implicitly includes <concepts> bill.trost at harmonicinc dot com
  2023-12-01 13:21 ` [Bug libstdc++/112796] " redi at gcc dot gnu.org
@ 2023-12-01 13:28 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2023-12-01 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #1)
> This is not a bug in GCC, the C++ standard allows any header to include any
> other.


See [res.on.headers] in the C++ standard:
"A C++ header may include other C++ headers. A C++ header shall provide the
declarations and definitions that appear in its synopsis. A C++ header shown in
its synopsis as including other C++ headers shall provide the declarations and
definitions that appear in the synopses of those other headers."

N.B. this is different from C, which does not allow e.g. <stdio.h> to include
<stdlib.h>.

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

end of thread, other threads:[~2023-12-01 13:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-30 23:33 [Bug libstdc++/112796] New: <algorithm> header implicitly includes <concepts> bill.trost at harmonicinc dot com
2023-12-01 13:21 ` [Bug libstdc++/112796] " redi at gcc dot gnu.org
2023-12-01 13:28 ` redi 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).