Overloading structs with template call operator and generic lambdas - gcc vs clang
I have discovered a code snippet that compiles and works properly in clang++ 4 (and trunk) but fails to compile in g++ 7 (and trunk) . Let's assume I have the following struct types: struct a { void foo() { } }; struct b { void bar() { } }; struct c { void bar() { } }; I want to create an overload set out of lambdas which handles a explicitly, while b and c are "caught" with a generic lambda using an auto parameter: auto ol = overload([](a x) { x.foo(); }, [](auto x){ x.bar(); }) When I invoke ol(a{}) : clang++ compiles and behaves as expected: a "matches" the first lambda, while b and c match