[Bug c++/84849] Ambiguous resolution of braze initializer list to a class with explicit constructors
lichray at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Jan 13 04:45:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84849
Zhihao Yuan <lichray at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lichray at gmail dot com
--- Comment #6 from Zhihao Yuan <lichray at gmail dot com> ---
Here is a possibly related case:
#include <tuple>
template <class T>
struct pair
{
using value_type = pair<std::remove_reference_t<T>>;
T a, b;
constexpr pair& operator=(value_type const& other)
{
a = other.a;
b = other.b;
return *this;
}
constexpr pair& operator=(value_type&& other)
{
a = std::move(other.a);
b = std::move(other.b);
return *this;
}
};
template <class T>
constexpr pair<T&> tie(T& a, T& b) noexcept
{
return { a, b };
}
int main()
{
int a = 3;
int b = 5;
tie(a, b) = { b, a % b }; // works
tie(a, b) = { b, a }; // wat
}
Error messages are very similar https://godbolt.org/z/4FSeOO.
More information about the Gcc-bugs
mailing list