From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19187 invoked by alias); 17 May 2003 07: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 19105 invoked by uid 71); 17 May 2003 07:36:00 -0000 Resent-Date: 17 May 2003 07:36:00 -0000 Resent-Message-ID: <20030517073600.19104.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, gprentice@paradise.net.nz Received: (qmail 8642 invoked by uid 48); 17 May 2003 07:30:55 -0000 Message-Id: <20030517073055.8641.qmail@sources.redhat.com> Date: Sat, 17 May 2003 07:36:00 -0000 From: gprentice@paradise.net.nz Reply-To: gprentice@paradise.net.nz To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/10832: spurious compiler errors for definition of explicit specialisation of template member function of explicitly specialised class X-SW-Source: 2003-05/txt/msg01964.txt.bz2 List-Id: >Number: 10832 >Category: c++ >Synopsis: spurious compiler errors for definition of explicit specialisation of template member function of explicitly specialised class >Confidential: no >Severity: critical >Priority: low >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Sat May 17 07:36:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Graeme Prentice >Release: GNU CPP version 3.2 (mingw special 20020817-1) (cpplib) (80386, BSD syntax) / also 3.2.3 >Organization: >Environment: Windows XP pro >Description: The following error messages are reported. C++ standard 14.7.3 para 5 describes out of class definition of non template member of an explicit specialisation of a template class does not have the "template <>" prefix but doesn't mention how to define an explicit specialisation of a template member function of such a class. Comeau and Borland compile the code without error. test1.cpp:14: wrong number of template arguments (1, should be 2) test1.cpp:3: provided for `template struct static_cast4' test1.cpp:14: ISO C++ forbids declaration of `type name' with no type test1.cpp:14: abstract declarator `int (static_cast4::)(long int)' used as declaration test1.cpp:14: no member function `$_0' declared in `static_cast4 ' test1.cpp:14: syntax error before `:' token >How-To-Repeat: template struct static_cast4; template <> struct static_cast4 { long h; template static_cast4(T); }; template <> static_cast4::static_cast4(long v):h(v){} int main() { static_cast4 o1(12L); } >Fix: Use a non template member function instead of the explicit specialisation. I suspect this is not a full workaround because when the member function is referred to with angle brackets appended e.g. somefunction<...> then the compiler can't select the non template function. template struct static_cast4; template <> struct static_cast4 { long h; template static_cast4(T); // workaround - non template member static_cast4(long v):h(v){} }; template static_cast4::static_cast4(T v):h(v){} int main() { static_cast4 o1(12L); } >Release-Note: >Audit-Trail: >Unformatted: