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

--- Comment #1 from songb432 at gmail dot com ---
Oops, the copy from Compiler Explorer is incorrect. Here's the correct one:
```
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::value (with mapping T-> V&*) and
                   // - true (with an empty mapping).
                   // Invalid type V&* formed in mapping => ill-formed NDR

static_assert(B<int>); // Shouldn't pass.

} // namespace Example1

namespace Example2 { // see also
https://eel.is/c++draft/temp.constr#op-example-2
template <class T> concept sad = true;
template <class T> concept sad_nested_type = sad<typename T::type>;
template <class T> int f(T) requires sad_nested_type<T> { return 0; }
//template <class T> int f(T) requires sad_nested_type<typename T::type>;
int i = f(42);        // substitution failure contained within sad_nested_type
} // namespace Example2

namespace Example2_ { // see also
https://eel.is/c++draft/temp.constr#op-example-2
template <class T> concept sad = true;
template <class T> concept sad_nested_type = sad<typename T::type>;
template <class T> int f(T) requires sad_nested_type<T> { return 0; }
template <class T> int f(T) requires 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() {}
```

Reply via email to