From: Jason Merrill Date: Tue, 23 Jun 2015 14:29:51 +0000 (-0400) Subject: re PR c++/65879 (Bogus linkage errors for member class of anonymous class) X-Git-Tag: releases/gcc-4.9.3~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b4a1730742cdd7d0cce7134ad7e5a21778c7a67;p=thirdparty%2Fgcc.git re PR c++/65879 (Bogus linkage errors for member class of anonymous class) PR c++/65879 * tree.c (no_linkage_check): Skip the 'this' pointer. From-SVN: r224847 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 599471245e24..94ab7dd88a5e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-06-23 Jason Merrill + + PR c++/65879 + * tree.c (no_linkage_check): Skip the 'this' pointer. + 2015-06-03 Jakub Jelinek Backported from mainline diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 2820ba0f9769..11c352143d45 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2193,14 +2193,14 @@ no_linkage_check (tree t, bool relaxed_p) return no_linkage_check (TYPE_PTRMEM_CLASS_TYPE (t), relaxed_p); case METHOD_TYPE: - r = no_linkage_check (TYPE_METHOD_BASETYPE (t), relaxed_p); - if (r) - return r; - /* Fall through. */ case FUNCTION_TYPE: { - tree parm; - for (parm = TYPE_ARG_TYPES (t); + tree parm = TYPE_ARG_TYPES (t); + if (TREE_CODE (t) == METHOD_TYPE) + /* The 'this' pointer isn't interesting; a method has the same + linkage (or lack thereof) as its enclosing class. */ + parm = TREE_CHAIN (parm); + for (; parm && parm != void_list_node; parm = TREE_CHAIN (parm)) { diff --git a/gcc/testsuite/g++.dg/other/anon7.C b/gcc/testsuite/g++.dg/other/anon7.C new file mode 100644 index 000000000000..12c1ab2039cc --- /dev/null +++ b/gcc/testsuite/g++.dg/other/anon7.C @@ -0,0 +1,10 @@ +// PR c++/65879 + +static struct +{ + void f(); + struct Inner + { + void g(); + }; +} x;