[Bug c++/82019] [concepts] ICE if concept is not satisfied

antoshkka at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Oct 15 13:42:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82019

--- Comment #2 from Antony Polukhin <antoshkka at gmail dot com> ---
Updated version of the test (works well on GCC 10):


// { dg-options "-std=c++2a" }

template <class T, class Data>
concept VectorOperations = requires(T& v, const Data& data) {
    v += data;
    requires __is_same_as(T&, decltype(v += data));
};

template <class Container, class Data>
    requires VectorOperations<Container, Data>
void compute_vector_optimal(Container& , const Data& ) {}

int main() {
    unsigned v1[] = {1,2,3};
    compute_vector_optimal(v1, v1); // { dg-error "cannot call function" }
}


More information about the Gcc-bugs mailing list