https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94126
Bug ID: 94126
Summary: [concepts] suboptimal diagnostic when type after
substitution is ill-formed
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ppalka at gcc dot gnu.org
Target Milestone: ---
$ cat disj.cc
template<typename T>
using blah = T::type;
template<typename T>
concept C = requires (T t) { t + 0; };
template<typename T>
concept D = C<T> || C<const T>;
template<typename T>
concept E = D<blah<T>>;
static_assert(E<int>);
$ g++ -std=c++2a disj.cc
disj.cc:13:15: error: static assertion failed
13 | static_assert(E<int>);
| ^~~~~~
disj.cc:13:15: note: constraints not satisfied
disj.cc:8:11: required for the satisfaction of ‘D<typename T::type>’
disj.cc:8:20: note: neither operand of the disjunction is satisfied
8 | concept D = C<T> || C<const T>;
| ~~~~~^~~~~~~~~~~~~
What the diagnostic should really say is that blah<int> is ill-formed. Maybe
something like:
disj.cc:13:15: error: static assertion failed
13 | static_assert(E<int>);
| ^~~~~~
disj.cc:13:15: note: constraints not satisfied
disj.cc:5:11: required for the satisfaction of ‘C<T>’
disj.cc:8:11: required for the satisfaction of ‘D<typename T::type>’
disj.cc:13:15: error: ‘int’ is not a class, struct, or union type