From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8506 invoked by alias); 10 Jun 2012 20:12:16 -0000 Received: (qmail 8498 invoked by uid 22791); 10 Jun 2012 20:12:15 -0000 X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 10 Jun 2012 20:12:02 +0000 From: "mikhail_semenov at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/53627] New: perfect forwarding for static int member Date: Sun, 10 Jun 2012 20:12:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mikhail_semenov at hotmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-06/txt/msg00529.txt.bz2 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 #include #include 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 void call(T&& x) { a(std::forward(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; }