https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67934
Bug ID: 67934 Summary: [concepts] ICE when providing default function implementations using concepts Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: michel.steuwer at gmail dot com Target Milestone: --- Created attachment 36483 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36483&action=edit Contains test case with preprocessed file. The following code fails with an ICE: === #include <iostream> template <typename T> concept bool JustEqualityComparable() { return requires(T a, T b) { { a == b } -> bool; }; } template <typename T> concept bool JustInequalityComparable() { return requires(T a, T b) { { a != b } -> bool; }; } bool operator==(const JustInequalityComparable& a1, const JustInequalityComparable& a2) { return !(a1 != a2); } bool operator!=(const JustEqualityComparable& a1, const JustEqualityComparable& a2) { return !(a1 == a2); } template <typename T> requires JustEqualityComparable<T>() bool useEq(T t1, T t2) { return t1 == t2; } struct A { int a; }; bool operator==(const A& a1, const A& a2) { return a1.a == a2.a; } int main() { using namespace std; cout << boolalpha << useEq(A{4}, A{6}) << "\n"; return 0; } === ~/bin/gcc/bin/g++ -std=c++1z -save-temps foo.cpp g++: internal compiler error: Segmentation fault (program cc1plus) Removing either the operator in line 19 or 24 makes the program compile. Replacing the operator implemented with concepts in line 19 by a plain template version makes the program compile as well.