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

            Bug ID: 86002
           Summary: ICE with requires in constexpr if condition
           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 44214
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44214&action=edit
Pre-processed source and command-line options

// ICE when using requires to detect welll-formedness of code using constexpr
if

struct X {};
struct Y { int i; };

template <typename T>
int f(T t)
{
    if constexpr (requires { t.i; })
        return t.i;
    else
        return {};
}

int main()
{
    return f(X{}) + f(Y{});
}

Reply via email to