From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15171 invoked by alias); 14 Mar 2010 20:25:50 -0000 Received: (qmail 14997 invoked by uid 48); 14 Mar 2010 20:25:37 -0000 Date: Sun, 14 Mar 2010 20:25:00 -0000 Subject: [Bug c++/43368] New: different access to templated structure static field give different results X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pogonyshev at gmx dot net" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-03/txt/msg01310.txt.bz2 Tested with Debian testing 4.4.3-3 and 4.3.4-8. Compiling this code snippet: template struct Foo { static int bar () { return field; } }; template struct X { static int x; typedef Foo foo; }; // This makes first statement in main() compile, but not the second... template <> int X ::x = 0; int main () { X ::x; X ::foo::bar (); } with 'g++ test.cpp -o test' gives the following error on linking stage: /tmp/ccuo8N2e.o: In function `_ZN3FooILZN1XIXT_EE1xEEE3barEv': test.cpp:(.text._ZN3FooILZN1XIXT_EE1xEEE3barEv[_ZN3FooILZN1XIXT_EE1xEEE3barEv]+0x4): undefined reference to `_ZN1XIXT_EE1xE' This is a regression: it works with 4.1, but doesn't with 4.3 or 4.4. Didn't test 4.2. -- Summary: different access to templated structure static field give different results Product: gcc Version: 4.4.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pogonyshev at gmx dot net GCC build triplet: i486-pc-linux-gnu GCC host triplet: i486-pc-linux-gnu GCC target triplet: i486-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43368