From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24361 invoked by alias); 30 Jun 2005 23:18:13 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 24239 invoked by uid 48); 30 Jun 2005 23:18:05 -0000 Date: Thu, 30 Jun 2005 23:18:00 -0000 From: "sebor at roguewave dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20050630231800.22263.sebor@roguewave.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/22263] New: explicit instantiation fails to emit symbols defined later X-Bugzilla-Reason: CC X-SW-Source: 2005-06/txt/msg03650.txt.bz2 List-Id: The program below fails to link with g++ 4.0 on Solaris 9 (I didn't try Linux). It appears that symbols defined after the explicit instantiation directive aren't emitted even when referenced. This works fine with prior versions of gcc. $ cat u.cpp && g++ u.cpp template struct S { T foo (); T bar (); }; template T S::foo () { return bar (); } template struct S; template T S::bar () { return T (); } int main () { return S().foo (); } Undefined first referenced symbol in file S::bar() /var/tmp//cc4BNMlG.o ld: fatal: Symbol referencing errors. No output written to a.out collect2: ld returned 1 exit status -- Summary: explicit instantiation fails to emit symbols defined later Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: critical Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sebor at roguewave dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: sparc-sun-solaris2.9 GCC host triplet: sparc-sun-solaris2.9 GCC target triplet: sparc-sun-solaris2.9 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22263