public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/31904]  New: fail to link to static const double
@ 2007-05-12  1:41 dennis0yang at gmail dot com
  2007-05-12  8:06 ` [Bug c++/31904] " fang at csl dot cornell dot edu
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: dennis0yang at gmail dot com @ 2007-05-12  1:41 UTC (permalink / raw)
  To: gcc-bugs

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


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

end of thread, other threads:[~2007-05-12 16:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-12  1:41 [Bug c++/31904] New: fail to link to static const double dennis0yang at gmail dot com
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

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