[Bug c++/53627] New: perfect forwarding for static int member
mikhail_semenov at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Jun 10 20:12:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53627
Bug #: 53627
Summary: perfect forwarding for static int member
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mikhail_semenov@hotmail.com
Created attachment 27600
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27600
The program file
The following program fails to link with the ld error report
C:\Users\Mikhail\AppData\Local\Temp\cc0HPRb8.o:perfect_forwarding_for_static_mem
ber.cpp:(.text+0x106): undefined reference to `Z::n'
collect2.exe: error: ld returned 1 exit status
#include <iostream>
#include <string>
#include <memory.h>
struct Z
{
static const double x;
static double y;
static const int n = 1000;
const double p;
Z():p(0.1){};
};
const double Z::x = 33.2;
double Z::y = 55.7;
void a(double d)
{
std::cout << "a(double): " << d << std::endl;
}
void a(int k)
{
std::cout << "a(int): " << k << std::endl;
}
template<class T>
void call(T&& x)
{
a(std::forward<T>(x));
}
int main()
{
int i = 10;
double x = 7.5;
static const double y = 2278.1;
a(i);
a(x);
a(y);
call(Z::x);
call(Z::y);
call(Z().p);
call(Z::n);
return 0;
}
More information about the Gcc-bugs
mailing list