public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "stefaandr at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/12222] New: explicit initialization of static template members seems ignored
Date: Tue, 09 Sep 2003 10:16:00 -0000	[thread overview]
Message-ID: <20030909101558.12222.stefaandr@hotmail.com> (raw)

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<float>::b1 instead of template <> b a<float>::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 <iostream>
struct b {
  b() { m = 1234; }; int m;
};
template <class T>
  struct a { static b b1; };
template struct a<float>;
template <> b a<float>::b1;
int main() {
  std::cout << a<float>::b1.m << std::endl;
};


             reply	other threads:[~2003-09-09 10:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-09 10:16 stefaandr at hotmail dot com [this message]
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

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=20030909101558.12222.stefaandr@hotmail.com \
    --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: link
Be 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).