template <typename Element>
struct tuple {
tuple () { }
template <typename UElements>
explicit
tuple (UElements&& elements)
{ static_assert(!sizeof(UElements), "first constructor"); }
template <typename UElements>
tuple (tuple<UElements>&& foo)
{ static_assert(!sizeof(UElements), "second constructor"); }
};
int
main (int argc, char* argv[]) {
tuple<int> f1;
tuple<unsigned> f2(f1);
return 0;
}
mainline currently gives me this error:
../src/main.cpp: In constructor âtuple<Element>::tuple(UElements&&) [with
UElements = tuple<int>&, Element = unsigned int]â:
../src/main.cpp:21: instantiated from here
../src/main.cpp:9: error: static assertion failed: "first constructor"
If I take the first constructor out, I get "second constructor" in the
error, so both constructors are actually entering the overload set.
Is this behaviour correct?