From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29575 invoked by alias); 15 May 2003 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 29538 invoked by uid 71); 15 May 2003 16:36:00 -0000 Resent-Date: 15 May 2003 16:36:00 -0000 Resent-Message-ID: <20030515163600.29537.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, bsmedberg@covad.net Resent-Reply-To: gcc-gnats@gcc.gnu.org, harinath@cs.umn.edu Received: (qmail 20998 invoked by uid 48); 15 May 2003 16:31:49 -0000 Message-Id: <20030515163149.20997.qmail@sources.redhat.com> Date: Thu, 15 May 2003 16:36:00 -0000 From: harinath@cs.umn.edu Reply-To: harinath@cs.umn.edu To: gcc-gnats@gcc.gnu.org Cc: bsmedberg@covad.net X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) X-GNATS-Notify: bsmedberg@covad.net Subject: c++/10804: regression from 3.2: implicit instantiation of template static methods X-SW-Source: 2003-05/txt/msg01802.txt.bz2 List-Id: >Number: 10804 >Category: c++ >Synopsis: regression from 3.2: implicit instantiation of template static methods >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu May 15 16:36:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: harinath@cs.umn.edu >Release: gcc version 3.4 20030512 (experimental) >Organization: >Environment: i686-pc-linux-gnu >Description: Linking fails on the following file: --8<-- template struct A { A() { const void (*a)() = foo; } static const void foo() {} }; int main(int argc, char *argv[]) { A a; } --8<-- with the error: /tmp/ccube68X.o(.gnu.linkonce.t._ZN1AIiEC1Ev+0x9): In function `A::A[in-charge]()': : undefined reference to `A::foo()' collect2: ld returned 1 exit status There is no problem with GCC 3.2. >How-To-Repeat: c++ implicit-instantiation.cc Here's the output of nm with GCC 3.4: U A::foo() 00000000 W A::A[in-charge]() 00000000 T main and here's the output with GCC 3.2 00000000 W A::foo() 00000000 W A::A[in-charge]() U __gxx_personality_v0 00000000 T main Notice that GCC 3.4 did DTRT with the constructor. If I replace the use of foo in the code with a direct method call, then there's no problem either. >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/x-c++src; name="implicit-instantiation.cc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="implicit-instantiation.cc" dGVtcGxhdGU8Y2xhc3MgVD4Kc3RydWN0IEEKewogIEEoKSB7IGNvbnN0IHZvaWQgKCphKSgpID0g Zm9vOyB9CiAgc3RhdGljIGNvbnN0IHZvaWQgZm9vKCkge30KfTsKCmludCBtYWluKGludCBhcmdj LCBjaGFyICphcmd2W10pCnsKICBBPGludD4gYTsKfQo=