Я ожидаю, что вызов f(signed{}) будет разрешен во время разрешения перегрузки, поскольку перегрузка f(std::integral auto) включена в набор перегрузок f с помощью объявления using с использованием b::f. Вызов f(unsigned{}) разрешается, поскольку f(std::unsigned_integral auto) более ограничен, чем f(std::integral auto), поскольку std:: unsigned_integral включает в себя std::integral.
Однако MSVC явно отвергает этот код. Какой параграф стандарта C++20 позволяет разрешить вызов f(signed{})?
Код: Выделить всё
#include
struct b { void f(std::integral auto); };
struct d : b { using b::f; void f(std::unsigned_integral auto); };
static_assert(requires { d{}.f(signed{}); }); // clang ok, gcc ok, msvc nope
static_assert(requires { d{}.f(unsigned{}); }); // all ok
Сообщение об ошибке MSVC:
Код: Выделить всё
(6): error C2672: 'd::f': no matching overloaded function found
(4): note: could be 'void d::f(_T0)'
(6): note: the associated constraints are not satisfied
(4): note: the concept 'std::unsigned_integral' evaluated to
false
C:/data/msvc/14.38.33133/include\concepts(76): note: the constraint was not
satisfied
(6): error C2607: static assertion failed
Источник: https://stackoverflow.com/questions/781 ... e-function