https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104503
Bug ID: 104503 Summary: [12 regression][modules] bits/shared_ptr_base.h: error: must ‘#include <typeinfo>’ before using ‘typeid’ Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: egor.pugin at gmail dot com Target Milestone: --- 11.2.1 works fine. #include <typeinfo> is present in include/c++/12.0.1/bits/shared_ptr_base.h Repro: cat << EOF > 1.cpp export module m; import <bits/stdc++.h>; EOF cat << EOF > 2.cpp import m; int main(){} EOF g++ -std=c++23 -fmodules-ts -x c++-system-header bits/stdc++.h g++ -std=c++23 -fmodules-ts -c 1.cpp g++ -std=c++23 -fmodules-ts -c 2.cpp Error: In file included from /home/egor/dev/gcc/build_debug/install/include/c++/12.0.1/bits/shared_ptr.h:53, from /home/egor/dev/gcc/build_debug/install/include/c++/12.0.1/memory:77, from /home/egor/dev/gcc/build_debug/install/include/c++/12.0.1/x86_64-pc-linux-gnu/bits/stdc++.h:82, of module /home/egor/dev/gcc/build_debug/install/include/c++/12.0.1/x86_64-pc-linux-gnu/bits/stdc++.h, imported at 1.cpp:2, of module m, imported at 2.cpp:1: /home/egor/dev/gcc/build_debug/install/include/c++/12.0.1/bits/shared_ptr_base.h: In instantiation of ‘void* std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_M_get_deleter(const std::type_info&) [with _Tp = std::mutex; _Alloc = std::allocator<void>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’: /home/egor/dev/gcc/build_debug/install/include/c++/12.0.1/bits/shared_ptr_base.h:631:7: required from here /home/egor/dev/gcc/build_debug/install/include/c++/12.0.1/bits/shared_ptr_base.h:641:21: error: must ‘#include <typeinfo>’ before using ‘typeid’ 62 | #include <ext/concurrence.h> +++ |+#include <typeinfo> 63 | #if __cplusplus >= 202002L ...... 641 | __ti == typeid(_Sp_make_shared_tag) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/egor/dev/gcc/build_debug/install/include/c++/12.0.1/bits/shared_ptr_base.h: In instantiation of ‘void* std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_M_get_deleter(const std::type_info&) [with _Tp = std::__future_base::_State_baseV2; _Alloc = std::allocator<void>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’: /home/egor/dev/gcc/build_debug/install/include/c++/12.0.1/bits/shared_ptr_base.h:631:7: required from here /home/egor/dev/gcc/build_debug/install/include/c++/12.0.1/bits/shared_ptr_base.h:641:21: error: must ‘#include <typeinfo>’ before using ‘typeid’ Build: Using built-in specs. COLLECT_GCC=/home/egor/dev/gcc/build_debug/install/bin/g++ COLLECT_LTO_WRAPPER=/home/egor/dev/gcc/build_debug/install/libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --disable-multilib --disable-bootstrap --prefix=/home/egor/dev/gcc/build_debug/install --disable-libsanitizer --disable-gcov --disable-libgomp --disable-libquadmath --disable-libssp --enable-languages=c,c++ Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.0.1 20220211 (experimental) (GCC)