------- Comment #12 from pinskia at gcc dot gnu dot org 2009-09-03 18:05 ------- (In reply to comment #11) > Subject: Re: should "sorry" when regparm=3 and nested functions are > encountered > > All, > > nested functions get passed a hidden argumment akin to static link/display > so that nested function can access the locals of its enclosing function. > > Passing a nested function as parameter to another function isn't going > to work correctly when the function is eventually called the > hidden argument isn't going to be setup correctly. > > I think the code is thus invalid and GCC should reject it.
It is valid as GCC creates a trampoline for the function pointer ... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41246