I wonder why this code does not compile:
struct S{ int m; };
template<class T, class = std::enable_if_t<std::is_same_v<T, S>>>
T& operator+=(T&& arg0, int arg1)
{
arg0.m += arg1;
return arg0;
}
int main()
{
S val0{ 0 }; int val1{ 1 };
val0 += val1;
return 0;
}
But it does compile either when SFINAE removed or when basic integer is used instead of a struct (with an appropriate template code change).