This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/20647] Wrong typeid for incomplete types
- From: "frederic dot riss at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Nov 2005 16:33:40 -0000
- Subject: [Bug libstdc++/20647] Wrong typeid for incomplete types
- References: <bug-20647-10337@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from frederic dot riss at gmail dot com 2005-11-06 16:33 -------
I nearly forgot that I submitted this bug report...
I got myself a version of the C++ standard since I submitted that, and I just
had a look at the part describing typeid :
5.2.8.4 reads : "When typeid is applied to a <i>type-id</i>, [...]. If the type
of the type-id is a class type or a reference to a class type, the class shall
be completely-defined."
I believe A* in 2.C qualifies a a reference to a not-completely defined class
type, and thus shouldn't be passed to std::typeid.
I'm not an expert in standard reading, but it seems to me that the current
behaviour isn't really a bug. If possible, I would be glad to see a warning
emited by GCC in that case, because I hit that problem in real-world code
(generic callback system using boost::any behind the scenes) and I spent hours
finding out what was happening. Maybe I should suggest adding a concept check
to the boost code if it is possible to detect it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20647