Re: [PATCH] PR c++/92236: Improve static assertions of concepts

2019-11-26 Thread Jason Merrill

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
concept iterator =
   requires (I i)
   {
 ++i;
 *i;
   };

static_assert(iterator);

Yields these errors:

x.cpp:11:15: error: static assertion failed
11 | static_assert(iterator);
   |   ^
x.cpp:11:15: note: constraints not satisfied
x.cpp:4:9:   required by the constraints of ‘template 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



[PATCH] PR c++/92236: Improve static assertions of concepts

2019-11-20 Thread Andrew Sutton
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
concept iterator =
  requires (I i)
  {
++i;
*i;
  };

static_assert(iterator);

Yields these errors:

x.cpp:11:15: error: static assertion failed
   11 | static_assert(iterator);
  |   ^
x.cpp:11:15: note: constraints not satisfied
x.cpp:4:9:   required by the constraints of ‘template 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


0001-Emit-detailed-diagnostics-for-static-assertion-failu.patch
Description: Binary data