This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch] Fix __is_base_of vs incomplete types


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]