Максимально сокращенный пример:
Код: Выделить всё
#include
template
struct MyContainer {
MyContainer() = default;
explicit MyContainer( std::size_t ) requires( std::default_initializable );
void resize( std::size_t ) requires( std::movable && std::default_initializable ) {}
};
struct A;
struct B {
MyContainer c;
};
struct A{};
int main() {
B b;
b.c.resize( 42 );
}
Код: Выделить всё
(18): error C7500: 'resize': no function satisfied its constraints
(7): note: could be 'void MyContainer::resize(size_t)'
(7): note: the 'MyContainer::resize' constraint was not satisfied
(7): note: the concept 'std::movable' evaluated to false
Содержит ли программа что-то противозаконное или ошибка неверна?
Подробнее здесь: https://stackoverflow.com/questions/791 ... n-visual-c