#include <variant>
struct A { };
struct B { };
struct Test
{
template<typename Ts>
struct overloaded : Ts { };
// 1st Deduction Guide
template<typename Ts>
overloaded(Ts)->overloaded<Ts>;
// 2nd Deduction Guide for class "A"
overloaded(A)->overloaded<A>;
void Fun()
{
// OK
overloaded obj1{ A{} };
// Error: No instance of constructor matches the argument list
// I think the 1st Deduction Guide is not effective inside class "Test"
overloaded obj2{ B{} };
}
};
int main()
{
// All Deduction …
Run Code Online (Sandbox Code Playgroud)