From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1651 invoked by alias); 23 Aug 2002 16:36:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 1595 invoked by uid 71); 23 Aug 2002 16:36:00 -0000 Resent-Date: 23 Aug 2002 16:36:00 -0000 Resent-Message-ID: <20020823163600.1594.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, leick.robinson@motorola.com Received: (qmail 29174 invoked by uid 61); 23 Aug 2002 16:29:32 -0000 Message-Id: <20020823162932.29173.qmail@sources.redhat.com> Date: Fri, 23 Aug 2002 10:26:00 -0000 From: leick.robinson@motorola.com Reply-To: leick.robinson@motorola.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/7704: template match difference on function pointer template args X-SW-Source: 2002-08/txt/msg00500.txt.bz2 List-Id: >Number: 7704 >Category: c++ >Synopsis: template match difference on function pointer template args >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Fri Aug 23 09:36:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: leick.robinson@motorola.com >Release: gcc 2.95.2 or gcc 3.0.4 >Organization: >Environment: SUNW,Ultra-60 SunOS 5.8 >Description: It's not clear whether the bug is in gcc 2.95.2 or 3.0.4. There's a difference in the way these releases match template arguments to the corresponding (partial) template specialization. In the code below, gcc 2.95.2 matches the function pointer argument ( A ) to the last specialization ( class A ). On the other hand, gcc 3.0.4 matches it to the specialization for pointers ( A ). Which is the correct behavior? >How-To-Repeat: #include using namespace std; template class A { public: static void foo() { cout << "Default A" << endl; } }; // Template specialization for a pointer template class A { public: static void foo() { cout << "A for pointers" << endl; } }; // Template specialization for function pointers (?) template class A { public: static void foo() { cout << "A for function pointers" << endl; }; }; int main() { A::foo(); A::foo(); A::foo(); } // g++ 2.95.2 produces: // // Default A // A for pointers // A for function pointers // // g++ 3.0.4 produces: // // Default A // A for pointers // A for pointers // >Fix: >Release-Note: >Audit-Trail: >Unformatted: