public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104503] New: [12 regression][modules] bits/shared_ptr_base.h: error: must ‘#include <typeinfo>’ before using ‘typeid’
@ 2022-02-11 15:00 egor.pugin at gmail dot com
  2022-02-14  8:21 ` [Bug c++/104503] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: egor.pugin at gmail dot com @ 2022-02-11 15:00 UTC (permalink / raw)
  To: gcc-bugs

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)

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

* [Bug c++/104503] [12 regression][modules] bits/shared_ptr_base.h: error: must ‘#include <typeinfo>’ before using ‘typeid’
  2022-02-11 15:00 [Bug c++/104503] New: [12 regression][modules] bits/shared_ptr_base.h: error: must ‘#include <typeinfo>’ before using ‘typeid’ egor.pugin at gmail dot com
@ 2022-02-14  8:21 ` rguenth at gcc dot gnu.org
  2022-03-28 13:33 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-14  8:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

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

* [Bug c++/104503] [12 regression][modules] bits/shared_ptr_base.h: error: must ‘#include <typeinfo>’ before using ‘typeid’
  2022-02-11 15:00 [Bug c++/104503] New: [12 regression][modules] bits/shared_ptr_base.h: error: must ‘#include <typeinfo>’ before using ‘typeid’ egor.pugin at gmail dot com
  2022-02-14  8:21 ` [Bug c++/104503] " rguenth at gcc dot gnu.org
@ 2022-03-28 13:33 ` jakub at gcc dot gnu.org
  2022-04-07  1:39 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-28 13:33 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The FE requires that std::type_info definition is seen before it can handle
typeid, so bet the module code needs to take it into account.

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

* [Bug c++/104503] [12 regression][modules] bits/shared_ptr_base.h: error: must ‘#include <typeinfo>’ before using ‘typeid’
  2022-02-11 15:00 [Bug c++/104503] New: [12 regression][modules] bits/shared_ptr_base.h: error: must ‘#include <typeinfo>’ before using ‘typeid’ egor.pugin at gmail dot com
  2022-02-14  8:21 ` [Bug c++/104503] " rguenth at gcc dot gnu.org
  2022-03-28 13:33 ` jakub at gcc dot gnu.org
@ 2022-04-07  1:39 ` jason at gcc dot gnu.org
  2022-04-07  5:39 ` egor.pugin at gmail dot com
  2022-05-10  9:18 ` vanyacpp at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-07  1:39 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jason at gcc dot gnu.org

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Egor Pugin from comment #0)
> cat << EOF > 1.cpp
> export module m;
> import <bits/stdc++.h>;
> EOF

> cat << EOF > 2.cpp
> import m;
> int main(){}
> EOF

This doesn't work because <typeinfo> is never imported into 2.cpp.  It's
imported into 1.cpp, but not exported from module m.  If you change the line in
1.cpp to

export import <bits/stdc++.h>;

then it works.

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

* [Bug c++/104503] [12 regression][modules] bits/shared_ptr_base.h: error: must ‘#include <typeinfo>’ before using ‘typeid’
  2022-02-11 15:00 [Bug c++/104503] New: [12 regression][modules] bits/shared_ptr_base.h: error: must ‘#include <typeinfo>’ before using ‘typeid’ egor.pugin at gmail dot com
                   ` (2 preceding siblings ...)
  2022-04-07  1:39 ` jason at gcc dot gnu.org
@ 2022-04-07  5:39 ` egor.pugin at gmail dot com
  2022-05-10  9:18 ` vanyacpp at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: egor.pugin at gmail dot com @ 2022-04-07  5:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Egor Pugin <egor.pugin at gmail dot com> ---
But what is using <typeinfo> in 2.cpp?
Module m does not export anything.

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

* [Bug c++/104503] [12 regression][modules] bits/shared_ptr_base.h: error: must ‘#include <typeinfo>’ before using ‘typeid’
  2022-02-11 15:00 [Bug c++/104503] New: [12 regression][modules] bits/shared_ptr_base.h: error: must ‘#include <typeinfo>’ before using ‘typeid’ egor.pugin at gmail dot com
                   ` (3 preceding siblings ...)
  2022-04-07  5:39 ` egor.pugin at gmail dot com
@ 2022-05-10  9:18 ` vanyacpp at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: vanyacpp at gmail dot com @ 2022-05-10  9:18 UTC (permalink / raw)
  To: gcc-bugs

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

Ivan Sorokin <vanyacpp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vanyacpp at gmail dot com

--- Comment #4 from Ivan Sorokin <vanyacpp at gmail dot com> ---
Could you please review the resolution? In 2.cpp nothing requires <typeinfo>.
Getting an error message about something that is not even used in the file
can't be right.

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

end of thread, other threads:[~2022-05-10  9:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-11 15:00 [Bug c++/104503] New: [12 regression][modules] bits/shared_ptr_base.h: error: must ‘#include <typeinfo>’ before using ‘typeid’ egor.pugin at gmail dot com
2022-02-14  8:21 ` [Bug c++/104503] " rguenth at gcc dot gnu.org
2022-03-28 13:33 ` jakub at gcc dot gnu.org
2022-04-07  1:39 ` jason at gcc dot gnu.org
2022-04-07  5:39 ` egor.pugin at gmail dot com
2022-05-10  9:18 ` vanyacpp at gmail dot com

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