------- Comment #18 from jakub at gcc dot gnu dot org  2009-06-12 18:58 -------
Often you don't see the constructor body, but still even if the constructor
isn't defined in the current CU this address can be taken there.
Also, even if the ctor doesn't remember the address of this, IMHO because of
NRV optimization anything else can.  Say if the ctor doesn't call a->k.bar
(this);, but baz is:
__attribute__ ((noinline))
H baz (void)
{
  H ret = new A;
  if (ret.a)
    ret.a->k.bar (&ret);
  return ret;
}
then it is baz that actually takes address of the temporary variable, not the
ctor.  And, similarly to the ctor, baz doesn't have to be defined in the
current CU.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40389

Reply via email to