From: Jason Merrill Date: Mon, 31 May 2021 16:56:34 +0000 (-0400) Subject: c++: alias member template [PR100102] X-Git-Tag: basepoints/gcc-13~7043 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1b3484a8e6c53c8084723e3f1738d402374198e;p=thirdparty%2Fgcc.git c++: alias member template [PR100102] Patrick already fixed the primary cause of this bug. But while I was looking at this testcase I noticed that with the qualified name k::o we ended up with a plain FUNCTION_DECL, whereas without the k:: we got a BASELINK. There seems to be no good reason not to return the BASELINK in this case as well. PR c++/100102 gcc/cp/ChangeLog: * init.c (build_offset_ref): Return the BASELINK for a static member function. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/alias-decl-73.C: New test. --- diff --git a/gcc/cp/init.c b/gcc/cp/init.c index b11232873000..1b161d526f6a 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2214,7 +2214,7 @@ build_offset_ref (tree type, tree member, bool address_p, if (!ok) return error_mark_node; if (DECL_STATIC_FUNCTION_P (t)) - return t; + return member; member = t; } else diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-73.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-73.C new file mode 100644 index 000000000000..aae778646dcc --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-73.C @@ -0,0 +1,9 @@ +// PR c++/100102 +// { dg-do compile { target c++11 } } + +template using a = int; +template struct k { + static long o(); + template using n = a; + n q; +};