public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: mgoodman@csua.berkeley.edu To: gcc-gnats@gcc.gnu.org Subject: c++/8166: A static const int class variable becomes an undefined symbol. Date: Mon, 07 Oct 2002 19:26:00 -0000 [thread overview] Message-ID: <200210080223.g982NQOS020537@vodka.corp.google.com> (raw) >Number: 8166 >Category: c++ >Synopsis: A static const int class variable becomes an undefined symbol. >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Mon Oct 07 19:26:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: mgoodman@csua.berkeley.edu >Release: 3.3 20021007 (experimental) >Organization: >Environment: System: Linux vodka 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386 GNU/Linux Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../gcc/configure --prefix=/home2/markg/local --enable-languages=c,c++ >Description: A static const int class variable becomes an undefined symbol in the object file. Since the constructor refers to it, the object file does not link. The bug is also filed at https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=75308. In that bug, I found the behavior in Red Hat 8's gcc 3.2. This bug is filed against CVS. [markg@vodka markg]$ g++ testclass.cc -o testclass /tmp/ccaUlTGx.o: In function `TestClass::TestClass[in-charge](TestClass const*)': /tmp/ccaUlTGx.o(.gnu.linkonce.t._ZN9TestClassC1EPKS_+0x1e): undefined reference to `TestClass::notDefined' collect2: ld returned 1 exit status >How-To-Repeat: g++ testclass.cc -o testclass The preprocessed source is below. # 1 "testclass.cc" # 1 "<built-in>" # 1 "<command line>" # 1 "testclass.cc" # 1 "/home2/markg/local/include/c++/3.3/cstddef" 1 3 # 47 "/home2/markg/local/include/c++/3.3/cstddef" 3 # 1 "/home2/markg/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" 1 3 4 # 151 "/home2/markg/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" 3 4 typedef int ptrdiff_t; # 213 "/home2/markg/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" 3 4 typedef unsigned int size_t; # 49 "/home2/markg/local/include/c++/3.3/cstddef" 2 3 namespace std { using ::ptrdiff_t; using ::size_t; } # 2 "testclass.cc" 2 class TestClass { public: static const int notDefined = -1; TestClass(const TestClass *parent) { i = parent ? parent->i : notDefined; } private: int i; }; TestClass test(__null); int main(void) { return 0; } >Fix: >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2002-10-08 2:26 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-10-07 19:26 mgoodman [this message] 2002-10-08 1:42 nathan
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=200210080223.g982NQOS020537@vodka.corp.google.com \ --to=mgoodman@csua.berkeley.edu \ --cc=gcc-gnats@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).