From: Mark Mitchell Date: Tue, 3 Feb 2004 20:01:59 +0000 (+0000) Subject: re PR c++/13925 (Bug while befriending specializations) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=18f5be99b4e9b8104748413f4538bb620d9f0a45;p=gcc.git re PR c++/13925 (Bug while befriending specializations) PR c++/13925 * decl.c (start_function): Do not call pushdecl for any instantiation or specialization of a primary template. PR c++/13925 * g++.dg/template/lookup5.C: New test. From-SVN: r77187 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7a398cba59f..47fbb965a2e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2004-02-03 Mark Mitchell + + PR c++/13925 + * decl.c (start_function): Do not call pushdecl for any + instantiation or specialization of a primary template. + 2004-02-03 Mark Mitchell PR c++/13950 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index c949c74d236..a70a2fa1b82 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -10272,8 +10272,9 @@ start_function (tree declspecs, tree declarator, tree attrs, int flags) if (!processing_template_decl && !(flags & SF_PRE_PARSED)) { /* A specialization is not used to guide overload resolution. */ - if (!DECL_TEMPLATE_SPECIALIZATION (decl1) - && ! DECL_FUNCTION_MEMBER_P (decl1)) + if (!DECL_FUNCTION_MEMBER_P (decl1) + && !(DECL_USE_TEMPLATE (decl1) && + PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (decl1)))) { tree olddecl = pushdecl (decl1); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 00c0b7138d3..f31c5c53007 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-02-03 Mark Mitchell + + PR c++/13925 + * g++.dg/template/lookup5.C: New test. + 2004-02-03 Mark Mitchell PR c++/13950 diff --git a/gcc/testsuite/g++.dg/template/lookup5.C b/gcc/testsuite/g++.dg/template/lookup5.C new file mode 100644 index 00000000000..022202a7158 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/lookup5.C @@ -0,0 +1,17 @@ +// PR c++/13925 + +namespace N { + template void f(T); + + namespace M { + class A { + friend void f(int); + }; + } + + template void f(T) {} + template <> void f(int ) + { + f(0); + } +}