This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/31904] New: fail to link to static const double


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]