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

            Bug ID: 101725
           Summary: simple requirement of parameter in defaulted non-type
                    template parameter considered non-dependent
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
                CC: johelegp at gmail dot com
  Target Milestone: ---

See https://godbolt.org/z/fer6on13z.
```C++
template<class T, bool V = (requires(T t) { x(t); })> constexpr bool
can_x_yet{V};
template<class T, bool V = (requires { y(*(T*)(0)); })> constexpr bool
can_y_yet{V};
```
The first line fails with:
```
<source>:1:47: error: parameter 't' may not appear in this context
    1 | template<class T, bool V = (requires(T t) { x(t); })> constexpr bool
can_x_yet{V};
      |                                               ^
<source>:1:45: error: there are no arguments to 'x' that depend on a template
parameter, so a declaration of 'x' must be available [-fpermissive]
    1 | template<class T, bool V = (requires(T t) { x(t); })> constexpr bool
can_x_yet{V};
      |                                             ^
<source>:1:45: note: (if you use '-fpermissive', G++ will accept your code, but
allowing the use of an undeclared name is deprecated)
Compiler returned: 1
```

Reply via email to