https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125605
Bug ID: 125605
Summary: crucial bug of concept/requires substitution and
normalization: missing logic; accepts invalid; wrong
result.
Product: gcc
Version: 16.1.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: songb432 at gmail dot com
Target Milestone: ---
See https://godbolt.org/z/fWEen4Kea
namespace Example1 {
template<typename T>
concept A = T::value || true;
template<typename U>
concept B = A<U*>; // OK: normalized to the disjunction of
// - T::value (with mapping T -> U*) and
// - true (with an empty mapping).
// No invalid type in mapping even though
// T::value is ill-formed for all pointer types
template<typename V>
concept C = B<V&>; // Normalizes to the disjunction of
// - T::… sad_nested_type<typename T::type>;
int i = f(42); // substitution failure contained within sad_nested_type
} // namespace Example2_
namespace Example3 { // see also
https://eel.is/c++draft/temp.constr#decl-example-2
template <class T> concept C = true;
template <class T> struct A {
template <class U> U f(U) requires C<typename T::type>; // #1
template <class U> U f(U) requires C<T>; // #2
};
using U = decltype(A<int>{}.f(2));
} // namespace Example3
int main() {}