This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ Patch] Fix __is_base_of vs incomplete types
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Jason Merrill <jason at redhat dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 03 Jan 2014 23:50:25 +0100
- Subject: Re: [C++ Patch] Fix __is_base_of vs incomplete types
- Authentication-results: sourceware.org; auth=none
- References: <52A3B01A dot 6070006 at oracle dot com> <52A93513 dot 3010703 at redhat dot com> <52A93B24 dot 3060200 at oracle dot com> <52A9C5FF dot 9040401 at redhat dot com> <52BD6C6C dot 5080606 at oracle dot com> <52C5DE26 dot 5000409 at redhat dot com> <52C6F365 dot 4040700 at oracle dot com> <52C705B5 dot 7070807 at redhat dot com>
Hi,
On 01/03/2014 07:47 PM, Jason Merrill wrote:
On 01/03/2014 12:29 PM, Paolo Carlini wrote:
- (lookup_base ((TYPE), (PARENT), ba_any, NULL, tf_none) != NULL_TREE)
+ (lookup_base ((TYPE), (PARENT), ba_any, NULL, tf_none) != NULL_TREE \
+ || ((TYPE) && NON_UNION_CLASS_TYPE_P (TYPE) \
+ && same_type_ignoring_top_level_qualifiers_p ((PARENT),
(TYPE))))
Let's only check one or the other, depending on whether TYPE is
incomplete.
The dispatching seems tricky, though, because lookup_base has:
if (!TYPE_P (t))
{
t_binfo = t;
t = BINFO_TYPE (t);
}
else
{
t = complete_type (TYPE_MAIN_VARIANT (t));
t_binfo = TYPE_BINFO (t);
}
thus TYPE_P (t) isn't necessarily true and, more importantly, otherwise
the function actively tries to complete the type. Do you think it can work?
Thanks,
Paolo.
PS: sorry about the sloppy comment in my last try ;)