public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/12222] explicit initialization of static template members seems ignored Date: Mon, 16 Aug 2004 18:37:00 -0000 [thread overview] Message-ID: <20040816183726.24681.qmail@sourceware.org> (raw) In-Reply-To: <20030909101558.12222.stefaandr@hotmail.com> ------- Additional Comments From bangerth at dealii dot org 2004-08-16 18:37 ------- gcc's behavior actually makes a lot more sense than anyone seems to have noticed: with this code ---------------- template <typename T> struct a { static int b1; }; template struct a<float>; template <> int a<float>::b1; int x = a<float>::b1; ----------------- we indeed get no warning that a specialization is declared after instantiating the template. However, that's about ok: we haven't provided a definition of the static member, so it isn't instantiated and the declaration of the specialization doesn't come too late. On the other hand, for this code (not the presence of the definition) ------------------ template <typename T> struct a { static int b1; }; template <typename T> int a<T>::b1; template struct a<float>; template <> int a<float>::b1; int x = a<float>::b1; ------------------ we _do_ get an error: g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -Wall -c x.cc x.cc:6: error: redefinition of `int a<float>::b1' x.cc:3: error: `int a<float>::b1' previously declared here I think gcc is correct here. So closing. W. -- What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12222
next prev parent reply other threads:[~2004-08-16 18:37 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-09-09 10:16 [Bug c++/12222] New: " stefaandr at hotmail dot com 2003-09-09 14:08 ` [Bug c++/12222] " bangerth at dealii dot org 2003-09-09 17:53 ` stefaandr at hotmail dot com 2003-09-09 18:57 ` bangerth at dealii dot org 2003-12-26 23:36 ` pinskia at gcc dot gnu dot org 2004-08-16 18:37 ` bangerth at dealii dot org [this message] [not found] <bug-12222-4@http.gcc.gnu.org/bugzilla/> 2012-02-01 3:07 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20040816183726.24681.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).