------- Comment #4 from jakub at gcc dot gnu dot org 2007-01-02 15:58 ------- I believe this was fixed by the PR26912 (4.2+ version) fix. Before those changes, the this argument was added by grokclassfn, after that change it is being added to all METHOD_TYPE type decls in grokfndecl. grokfndecl is here called from the friend decl, so grokdeclarator's: 8388 /* All method decls are public, so tell grokfndecl to set 8389 TREE_PUBLIC, also. */ 8390 decl = grokfndecl (ctype, type, 8391 TREE_CODE (unqualified_id) != TEMPLATE_ID_EXPR 8392 ? unqualified_id : dname, 8393 parms, 8394 unqualified_id, 8395 virtualp, flags, quals, raises, 8396 friendp ? -1 : 0, friendp, 1, 0, sfk, 8397 funcdef_flag, template_count, in_namespace, friendp is non-zero and therefore grokclassfn is never called. Later on revert_static_member_fn assumes the first argument is "this" without checking it and eats the first argument.
Mark, do you think it is better for 4.1 to backport another part of your changes (i.e. the build_this_parm function addition and related changes), or e.g. just copy over the "this" addition code after this grokfndecl call if (friendp)? Or change revert_static_method to only remove "this" argument? -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mark at codesourcery dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29054