public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53627] New: perfect forwarding for static int member
@ 2012-06-10 20:12 mikhail_semenov at hotmail dot com
  2012-06-10 20:29 ` [Bug c++/53627] " paolo.carlini at oracle dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: mikhail_semenov at hotmail dot com @ 2012-06-10 20:12 UTC (permalink / raw)
  To: gcc-bugs

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;          
}


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-06-11  6:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-10 20:12 [Bug c++/53627] New: perfect forwarding for static int member mikhail_semenov at hotmail dot com
2012-06-10 20:29 ` [Bug c++/53627] " paolo.carlini at oracle dot com
2012-06-10 21:03 ` manu at gcc dot gnu.org
2012-06-10 21:11 ` daniel.kruegler at googlemail dot com
2012-06-10 21:23 ` daniel.kruegler at googlemail dot com
2012-06-10 21:26 ` daniel.kruegler at googlemail dot com
2012-06-10 21:37 ` redi at gcc dot gnu.org
2012-06-10 21:50 ` redi at gcc dot gnu.org
2012-06-11  6:48 ` daniel.kruegler at googlemail dot com
2012-06-11  6:48 ` daniel.kruegler at googlemail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).