https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82019
Bug ID: 82019 Summary: [concepts] ICE if concept is not satisfied Product: gcc Version: c++-concepts Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Following code causes ICE: template <class T, class Data> concept bool VectorOperations = requires(T& v, const Data& data) { { v += data } -> T&; }; template <class Container, class Data> requires VectorOperations<Container, Data> void compute_vector_optimal(Container& v, const Data& data) { } int main() { unsigned v1[] = {1,2,3}; compute_vector_optimal(v1, v1); } Error: ../tests/main.cpp:26:9: internal compiler error: in cp_build_addr_expr_1, at cp/typeck.c:5741 { v += data } -> T&; ~~^~~~~~~ 0x661c40 cp_build_addr_expr_1 ../../src/gcc/cp/typeck.c:5741 0x662541 cp_build_addr_expr(tree_node*, int) ../../src/gcc/cp/typeck.c:5840 0x662541 decay_conversion(tree_node*, int, bool) ../../src/gcc/cp/typeck.c:2032 0x6638b2 cp_build_binary_op(unsigned int, tree_code, tree_node*, tree_node*, int) ../../src/gcc/cp/typeck.c:4171 0x66bb6f cp_build_modify_expr(unsigned int, tree_node*, tree_code, tree_node*, int) ../../src/gcc/cp/typeck.c:7813 0x5ad167 build_new_op_1 ../../src/gcc/cp/call.c:5943 0x5adbee build_new_op(unsigned int, tree_code, int, tree_node*, tree_node*, tree_node*, tree_node**, int) ../../src/gcc/cp/call.c:6026 0x66c62b build_x_modify_expr(unsigned int, tree_node*, tree_code, tree_node*, int) ../../src/gcc/cp/typeck.c:8009 0x5e832c tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../src/gcc/cp/pt.c:16993 0x5e1e77 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../src/gcc/cp/pt.c:16468 0x6e607f tsubst_compound_requirement ../../src/gcc/cp/constraint.cc:1817 0x6e607f tsubst_requirement ../../src/gcc/cp/constraint.cc:1848 0x6e607f tsubst_requirement_body ../../src/gcc/cp/constraint.cc:1867 0x6e607f tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*) ../../src/gcc/cp/constraint.cc:1899 0x5e8f78 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../src/gcc/cp/pt.c:17919 0x5e1e77 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../src/gcc/cp/pt.c:16468 0x6e3927 expand_concept(tree_node*, tree_node*) ../../src/gcc/cp/constraint.cc:565 0x6e4ecc satisfy_check_constraint ../../src/gcc/cp/constraint.cc:2056 0x6e4ecc satisfy_constraint_1 ../../src/gcc/cp/constraint.cc:2247 0x6e5270 satisfy_constraint ../../src/gcc/cp/constraint.cc:2302 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions. make: *** [main.o] Error 1