[Bug c++/79982] Compiler crashes when using illegal concepts (nested requirements)

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Oct 14 17:44:00 GMT 2019


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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
No crash on current trunk, with an updated example using C++2a syntax:

template <typename T> concept Void = __is_same_as(T, void);

template <typename T>
concept my_concept = requires(T t)
{
    requires requires (int val) { { t.serialize(val) } -> Void; };
};

class my_class
{
    void serialize(int);
};

static_assert(my_concept<my_class>);


It fails now:

79982.cc:14:15: error: static assertion failed
   14 | static_assert(my_concept<my_class>);
      |               ^~~~~~~~~~~~~~~~~~~~


More information about the Gcc-bugs mailing list