From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32306 invoked by alias); 24 Dec 2002 03:06: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 32287 invoked by uid 71); 24 Dec 2002 03:06:01 -0000 Resent-Date: 24 Dec 2002 03:06:01 -0000 Resent-Message-ID: <20021224030601.32286.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, martin@xemacs.org Received: (qmail 10996 invoked by uid 61); 24 Dec 2002 03:00:41 -0000 Message-Id: <20021224030041.10995.qmail@sources.redhat.com> Date: Mon, 23 Dec 2002 19:06:00 -0000 From: martin@xemacs.org Reply-To: martin@xemacs.org To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/9050: Can't explicitly instantiate C++ constructor templates X-SW-Source: 2002-12/txt/msg01255.txt.bz2 List-Id: >Number: 9050 >Category: c++ >Synopsis: Can't explicitly instantiate C++ constructor templates >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Mon Dec 23 19:06:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Martin Buchholz >Release: g++ 3.2.1 >Organization: >Environment: Linux x86 >Description: C++ function templates can be explicitly instantiated. Constructors can be function templates. So the following should compile (and indeed does with icc and Comeau C++) struct Y { template Y (T); template void foo (T); }; template <> void Y::foo (bool) { } template <> void Y::foo (int) { } template <> Y::Y (bool) { } template <> Y::Y (int) { } Explicit instantiation of Y::foo, but not Y::Y, is permitted. g++ gives these errors: (not only is g++ wrong to give an error, but the error message below contains the nonsensical "no member function `._0' declared") constructor-explicit-instantiation-bug.cc:11: `Y' is not a template constructor-explicit-instantiation-bug.cc:11: ISO C++ forbids declaration of ` type name' with no type constructor-explicit-instantiation-bug.cc:11: abstract declarator `int (Y::)(int)' used as declaration constructor-explicit-instantiation-bug.cc:11: no member function `._0' declared in `Y' constructor-explicit-instantiation-bug.cc:11: syntax error before `{' token >How-To-Repeat: Compile the provided fragment with "g++ -c" >Fix: >Release-Note: >Audit-Trail: >Unformatted: