weird bug with nested functions:

Johannes Pfau nospam at example.com
Sun Feb 10 01:05:10 PST 2013


Am Fri, 8 Feb 2013 14:05:24 +0100
schrieb Johannes Pfau <nospam at example.com>:

> https://gist.github.com/jpf91/4738922
> 

OK, found it and found a fix. As a result functions in nested structs
can now also have static chains.

With my changes it's possible that a function in a template instance
has a static chain. So we can have functions which are nested, but
for which we still need to call make_decl_one_only.

There's a small problem: makeDeclOneOnly has this comment:

      /* Weak definitions have to be public.  Nested functions may or
	 may not be emitted as public even if TREE_PUBLIC is set.
	 There is no way to tell if the back end implements
	 make_decl_one_only with DECL_WEAK, so this check is
	 done first.  */

and therefore it doesn't mark nested functions as one-only.

Do you know if that statement is still true for recent gcc versions? I
removed that check and there were no regressions.


More information about the D.gnu mailing list