public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34094]  New: Undefined static data member can acquire a definition anyway
@ 2007-11-14 18:43 simon_baldwin at yahoo dot com
  2007-11-14 19:21 ` [Bug c++/34094] Undefined static data member in anonymous namespace " pinskia at gcc dot gnu dot org
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: simon_baldwin at yahoo dot com @ 2007-11-14 18:43 UTC (permalink / raw)
  To: gcc-bugs

The following program should fail to link, since <anonymous>::B::x is declared
but not defined.  However, the program compiles, links, and runs with gcc 4.2.1
and with a relatively recent 4.3 snapshot.

This same program fails to build under gcc 4.1 and earlier, icc 8.1, and Comeau
test drive.

struct A {
  A(void *) {}
};

namespace {

struct B : public A {
  B() : A(&x) {}
  static int x;  // declared, but never defined
};

}

int main() {
  B::x = 0;
}


-- 
           Summary: Undefined static data member can acquire a definition
                    anyway
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: simon_baldwin at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34094


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2008-02-22 18:04 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-14 18:43 [Bug c++/34094] New: Undefined static data member can acquire a definition anyway simon_baldwin at yahoo dot com
2007-11-14 19:21 ` [Bug c++/34094] Undefined static data member in anonymous namespace " pinskia at gcc dot gnu dot org
2007-11-15  4:40 ` bangerth at dealii dot org
2007-11-15 19:56 ` simon_baldwin at yahoo dot com
2007-11-19  5:22 ` [Bug c++/34094] [4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
2007-11-20 18:01 ` jakub at gcc dot gnu dot org
2007-11-22 14:06 ` jakub at gcc dot gnu dot org
2007-11-22 14:07 ` [Bug c++/34094] [4.2 " jakub at gcc dot gnu dot org
2007-11-25 20:46 ` pinskia at gcc dot gnu dot org
2007-12-11  8:42 ` jakub at gcc dot gnu dot org
2007-12-11  8:48 ` jakub at gcc dot gnu dot org
2007-12-11  8:49 ` [Bug c++/34094] [4.2/4.3 " jakub at gcc dot gnu dot org
2007-12-12 20:57 ` mmitchel at gcc dot gnu dot org
2007-12-18 23:47 ` crowl at google dot com
2007-12-18 23:52 ` pinskia at gcc dot gnu dot org
2008-02-01 17:02 ` jsm28 at gcc dot gnu dot org
2008-02-10 16:34 ` jason at gcc dot gnu dot org
2008-02-10 18:13 ` jason at gcc dot gnu dot org
2008-02-12  6:39 ` jason at gcc dot gnu dot org
2008-02-12  6:42 ` jason at gcc dot gnu dot org
2008-02-22 17:51 ` pinskia at gcc dot gnu dot org
2008-02-22 18:04 ` jason at gcc dot gnu dot org

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).