c++: typeid and instantiation [PR102651]
authorJason Merrill <jason@redhat.com>
Fri, 15 Apr 2022 04:11:00 +0000 (00:11 -0400)
committerJason Merrill <jason@redhat.com>
Sun, 15 May 2022 09:47:40 +0000 (05:47 -0400)
commit5237059e04d105fe5441fa7434699eea9a34bf1b
treee1ece4de11a94776d0ea413e700365faeefab60e
parentdbd77e660f57c880a46591074ac3172d729cfb87
c++: typeid and instantiation [PR102651]

PR49387 was a problem with initially asking for a typeid for a class
template specialization before it was complete, and later actually filling
in the descriptor when the class was complete, and thus disagreeing on the
form of the descriptor.  I fixed that by forcing the class to be complete,
but this testcase shows why that approach is problematic.  So instead let's
adjust the type of the descriptor later if needed.

PR c++/102651
PR c++/49387

gcc/cp/ChangeLog:

* rtti.cc (get_tinfo_decl_direct): Don't complete_type.
(emit_tinfo_decl): Update tdesc type if needed.

gcc/testsuite/ChangeLog:

* g++.dg/rtti/typeid-complete1.C: New test.
gcc/cp/rtti.cc
gcc/testsuite/g++.dg/rtti/typeid-complete1.C [new file with mode: 0644]