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

            Bug ID: 121827
           Summary: ext/pointer.h can't be included alone and ext/cast.h
                    shouldn't be included in extc++.h
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Created attachment 62329
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62329&action=edit
extc++.cc

I've tried to include each header included in bits/{extc++,stdc++,stdtr1c++}.h
under the conditions listed in there to make sure I they are all
self-contained.
Attached file is bits/extc++.h with the other two headers manually included,
all #include lines replaced with small hack to include it only sometimes and
empty lines and comments removed.
for i in c++98 c++11 c++14 c++17 c++20 c++23 c++26; do for j in `seq 700`; do
~/src/gcc/obj34/gcc/xg++ -B ~/src/gcc/obj34/gcc/
`~/src/gcc/obj34/x86_64-pc-linux-gnu/libstdc++-v3/scripts/testsuite_flags
--build-includes` -S extc++.cc -std=$i -DNNN=$j; done; echo Done $i; done
This shows 2 problems:
In file included from extc++.cc:584:
/home/jakub/src/gcc/obj34/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/cast.h:33:21:
error: expected ‘{’ before ‘_GLIBCXX_VISIBILITY’
   33 | namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
      |                     ^~~~~~~~~~~~~~~~~~~
/home/jakub/src/gcc/obj34/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/cast.h:33:40:
error: expected constructor, destructor, or type conversion before ‘(’ token
   33 | namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
      |                                        ^
In file included from extc++.cc:593:
/home/jakub/src/gcc/obj34/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/pointer.h:573:17:
error: ‘basic_ostream’ in namespace ‘std’ does not name a template type
  573 |     inline std::basic_ostream<_CharT, _Traits>&
      |                 ^~~~~~~~~~~~~

The first one is that ext/cast.h is marked as internal header in comments and
doesn't include even <bits/c++config.h>, so IMHO shouldn't be listed in
extc++.h at all, <ext/pointer.h> will include that.
And the other one is that apparently since GCC 13 (according to godbolt)
doesn't include what it needs, clearly since r13-3037-g18f176d0b25591e28

Reply via email to