Boost logo

Boost Users :

Subject: [Boost-users] [move] non-inline move constructor - won't compile
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2013-11-02 07:02:53


Hi,

I've been trying to writhe a non-inline move constructor, to place its'
implementation in a .cpp file. I'm having problems compiling my code, which
I managed to simplify (after examining output of the preprocessor) down to
this short code snippet:

#include <boost/move/core.hpp>

struct X
{
    X( ::boost::rv< X >& x );
    operator ::boost::rv<X>&() { return *static_cast< ::boost::rv<X>*
>(this); }
};

X::X( ::boost::rv< X >& x ) {}

Compiling a .cpp file with the above contents gives me:

a.cpp:41:1: error: prototype for 'X::X(boost::rv<X>&)' does not match any
in class 'X'
 X::X( ::boost::rv< X >& x ) {}
 ^
a.cpp:35:8: error: candidates are: X::X(const X&)
 struct X
        ^
a.cpp:37:5: error: X::X(boost::rv<X>&)
     X( ::boost::rv< X >& x );
     ^

I'm using MinGW gcc 4.8.1 in default -std mode (not-C++11 mode), boost-1.54.

Am I doing something wrong here, or is it a bug in the compiler?

Regards,
Kris



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net