https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107360
--- Comment #5 from Martin Uecker <muecker at gwdg dot de> --- Yes. After reconsidering this, this is not related to the other bugs mentioned above. I think your first example needs to be invalid, because the derived return type then depends on a variable inside the nested functions, which can not work without new pointer types. The second example could work.