This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[c++0x] _Tuple_impl and typename reference_wrapper<T>::type&&
- From: "Pedro LamarÃo" <pedro dot lamarao at gmail dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Thu, 14 Feb 2008 14:30:52 -0200
- Subject: [c++0x] _Tuple_impl and typename reference_wrapper<T>::type&&
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