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

            Bug ID: 86000
           Summary: ICE with requires statement in a non constexpr if
           Product: gcc
           Version: 8.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc-bugs at oxyware dot com
  Target Milestone: ---

Created attachment 44213
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44213&action=edit
Preprocessed source with command-line options

// This code when compiled with -fconcepts causes an ICE.  I'm not
// sure if this should even compile.  I am expecting that the requires
// clause will return true since "3 > 4;" is well-formed.  When compiled
// with -std=c++17 then if constexpr(requires { 3 > 4; }) does compile and
// the function returns 1.

template <typename T>
int f()
{
    if (requires { 3 > 4; }) return 1;
    else return 2;
}

int main()
{
    return f<int>();
}

Reply via email to