msvc и gcc пройти без ошибок или предупреждений. < /p>
Компиляция:
Код: Выделить всё
g++ -std=c++2c -fsyntax-only minrepro8.cpp -Wall -Wextra -pedantic< /code>
cl /std:c++latest /Zs minrepro8.cpp /nologo /Wall /EHsc< /code>
clang++ -std=c++2c -fsyntax-only minrepro8.cpp -Wall -Wextra -pedanticКод: Выделить всё
#include
#include
struct abcd {};
template
concept Abcd = std::same_as;
template
requires (std::is_pointer_v)
void operator +=(t0 &, t1) {}
template
void operator +=(t0 &, std::type_identity_t) {}
void User(abcd a, int *b) {
b += a; // FAILS
operator +=(b, a); // WORKS
}
< /code>
minrepro8.cpp:14:6: error: overloaded 'operator+=' must have at least one parameter of class or enumeration type
14 | void operator +=(t0 &, std::type_identity_t) {}
| ^
minrepro8.cpp:17:7: note: in instantiation of function template specialization 'operator+=' requested here
17 | b += a; // FAILS
| ^
1 error generated.
< /code>
I don't know anything about clang's front-end. I guess this happens:
[*]Every overload must be checked to test for ambiguities.
[*]The 2nd overload has a single deduced type
[*]int *[*]
Код: Выделить всё
t0Окончательные типы параметров (int *&, int *< /code>) было обнаружено, что категорически недействительными. < /li>
< /ol>
, где проверка сдержанности будет проходить потом, я не уверен.>
Подробнее здесь: https://stackoverflow.com/questions/797 ... n-on-clang
Мобильная версия