[C++ Patch] for c++/11750

Fabien Chêne fabien.chene@gmail.com
Tue Nov 6 19:59:00 GMT 2012


Jason, could you please have a look at this (rather old) one ?
Thanks.

2012/8/13 Fabien Chêne <fabien.chene@gmail.com>:
> Hi,
>
> Here, we were setting the LOOKUP_NONVIRTUAL flag wrongly. Actually, we
> need to check if the function context is the same than the instance
> type -- yes that might happen that they be different in presence of
> using-declarations.
>
> It happens that it was working if the call was invoked through a
> pointer, that's because  we were failing to determine the dynamic type
> (in resolved_fixed_type_p). On the contrary, it wasn't working if the
> call was done through a reference because we manage to determine the
> dynamic_type thanks to a special case in fixed_type_or_null. There is
> probably room for improvement here, though I'm not sure the C++ front
> end is the better place to de-virtualize.
>
> Tested x84_64-unknown-linux-gnu without regressions. OK to commit ?
>
> gcc/testsuite/ChangeLog
>
> 2012-08-12  Fabien Chêne  <fabien@gcc.gnu.org>
>
>         PR c++/11750
>         * g++.dg/inherit/vitual9.C: New.
>
> gcc/cp/ChangeLog
>
> 2012-08-12  Fabien Chêne  <fabien@gcc.gnu.org>
>
>         PR c++/11750
>         * call.c (build_new_method_call_1): Check that the instance type
>         and the function context are the same before setting the flag
>         LOOKUP_NONVIRTUAL.
>
>
> --
> Fabien

-- 
Fabien



More information about the Gcc-patches mailing list