public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dennis0yang at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/31904] New: fail to link to static const double Date: Sat, 12 May 2007 01:41:00 -0000 [thread overview] Message-ID: <bug-31904-14536@http.gcc.gnu.org/bugzilla/> (raw) The following code fail to compile under cygwin. The relevant error message is: ...: undefined reference to `Base::x' collect2: ld returned 1 exit status However if I change the statement "y=-x" to "y=x", then it compiles fine. class Base { public: virtual void f () = 0; static const double x = 1; }; class Derived : public Base { public: Derived () {}; void f () { double y = -x; }; }; int main() { Derived foo; return 0; } ~ -- Summary: fail to link to static const double Product: gcc Version: 3.4.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dennis0yang at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31904
next reply other threads:[~2007-05-12 1:41 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-05-12 1:41 dennis0yang at gmail dot com [this message] 2007-05-12 8:06 ` [Bug c++/31904] " fang at csl dot cornell dot edu 2007-05-12 8:15 ` schwab at suse dot de 2007-05-12 8:29 ` dennis0yang at gmail dot com 2007-05-12 8:33 ` dennis0yang at gmail dot com 2007-05-12 15:53 ` fang at csl dot cornell dot edu 2007-05-12 16:19 ` dennis0yang at gmail dot com 2007-05-12 16:53 ` fang at csl dot cornell dot edu
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=bug-31904-14536@http.gcc.gnu.org/bugzilla/ \ --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).