This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/31904] New: fail to link to static const double
- From: "dennis0yang at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 May 2007 01:41:11 -0000
- Subject: [Bug c++/31904] New: fail to link to static const double
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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