On 11/20/19 10:45 AM, Andrew Sutton wrote:
This patch builds on https://gcc.gnu.org/ml/gcc-patches/2019-11/msg01034.html.

Tie static assertion diagnostics into constraint diagnostic. For
example, this program:

template<typename I>
concept iterator =
   requires (I i)
   {
     ++i;
     *i;
   };

static_assert(iterator<int>);

Yields these errors:

x.cpp:11:15: error: static assertion failed
    11 | static_assert(iterator<int>);
       |               ^~~~~~~~~~~~~
x.cpp:11:15: note: constraints not satisfied
x.cpp:4:9:   required by the constraints of ‘template<class I> concept iterator’
x.cpp:5:3:   in requirements with ‘int i’
x.cpp:8:5: note: the required expression ‘* i’ is invalid
     8 |     *i;
       |     ^~

Andrew Sutton

OK.

Jason

Reply via email to