[c++0x] _Tuple_impl and typename reference_wrapper<T>::type&&
Pedro Lamarão
pedro.lamarao@gmail.com
Thu Feb 14 16:52:00 GMT 2008
I traced my difficulty with the <tuple> in HEAD to the following case:
[psilva@desen cxx]$ cat MoveOnly.hpp
#ifndef MOVEONLY_HPP
#define MOVEONLY_HPP
struct MoveOnly {
MoveOnly () { }
MoveOnly (MoveOnly&&) { }
MoveOnly& operator= (MoveOnly&&) { return *this; }
private:
MoveOnly (MoveOnly const&); // = delete
MoveOnly& operator= (MoveOnly const&); // = delete
};
inline
MoveOnly
make_move_only () { return MoveOnly(); }
#endif
[psilva@desen cxx]$ cat test.cpp
#include <utility>
#include "MoveOnly.hpp"
class A {
public:
template <typename T>
explicit
A (typename std::remove_reference<T>::type&&) { }
};
int
main (int argc, char* argv[]) {
A a(make_move_only());
}
[psilva@desen cxx]$ g++-4.3 --std=c++0x test.cpp
test.cpp: In function 'int main(int, char**)':
test.cpp:17: error: no matching function for call to 'A::A(MoveOnly)'
test.cpp:5: note: candidates are: A::A(const A&)
I don't actually know what to think about the test above.
This is exactly what happens in _Tuple_impl when passed an rvalue: the
equivalent template constructor overload never enters the overload
set.
This doesn't seem to be a substitution failure.
Is this code valid?
--
Pedro Lamarão
"The True Self is the meaning of the True Will:
know thyself through Thy Way."
-- The Book of Thoth
More information about the Libstdc++
mailing list