[Bug c++/31904] New: fail to link to static const double
dennis0yang at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat May 12 01:41:00 GMT 2007
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
More information about the Gcc-bugs
mailing list