From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18178 invoked by alias); 9 Sep 2003 10:16:02 -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 18169 invoked by uid 48); 9 Sep 2003 10:16:01 -0000 Date: Tue, 09 Sep 2003 10:16:00 -0000 From: "stefaandr at hotmail dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20030909101558.12222.stefaandr@hotmail.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/12222] New: explicit initialization of static template members seems ignored X-Bugzilla-Reason: CC X-SW-Source: 2003-09/txt/msg00751.txt.bz2 List-Id: PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12222 Summary: explicit initialization of static template members seems ignored Product: gcc Version: 3.4 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: stefaandr at hotmail dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu Shouldn't this code output 1234? It outputs 0 for me. I used to write b a::b1 instead of template <> b a::b1, but I tried this after seeing comment 3 on bug 11930. I can even change the constructor of b into a non-default one and it still compiles... using g++-3.4 (GCC) 3.4 20030907 (experimental) #include struct b { b() { m = 1234; }; int m; }; template struct a { static b b1; }; template struct a; template <> b a::b1; int main() { std::cout << a::b1.m << std::endl; };