Skip to content

overload: ambiguous for compatible types #16

@pitti98

Description

@pitti98

If you use final function objects to overload on types that are implicitly convertible to each other the overload becomes ambiguous.

Example:

struct X;
struct Y {
//	Y(const X&){} // enable this to fail
};
struct X {
//	operator Y() const { return Y(); }  // or enable this to fail
};

struct Foo final { void operator()(X) const { printf("X\n"); } };
struct Bar final { void operator()(Y) const { printf("Y\n"); } };
int main()
{
	auto ol = std::experimental::overload(Foo(), Bar());
	ol(X());
	return 0;
}

This ticket was opened as requested on https://github.com/viboes/tags/issues/7.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions