You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
template <typename T> concept C = true;
template <typename T> constexprbool I = true;
template <typename T> requires(C<T>) auto a(T&& t) { };
template <typename T> requires(I<T>) auto b(T&& t) { };
auto c = [] <typename T> requires(C<T>) (T&& t) { };
auto d = [] <typename T> requires(I<T>) (T&& t) { };
complaining that:
<source>:8:42: error: 'T' does not refer to a valueauto d = [] <typename T> requires(I<T>) (T&& t) { }; ^<source>:8:23: note: declared hereauto d = [] <typename T> requires(I<T>) (T&& t) { }; ^<source>:8:46: error: use of undeclared identifier 't'auto d = [] <typename T> requires(I<T>) (T&& t) { }; ^2 errors generated.Compiler returned: 1
If a concept is used instead of an variable template, the code compiles fine. A function definition of similar construction (explicit template parameter and a use of a dependent variable template in the requires clause) is also fine.
Top of trunk Clang rejects the following code:
complaining that:
If a concept is used instead of an variable template, the code compiles fine. A function definition of similar construction (explicit template parameter and a use of a dependent variable template in the requires clause) is also fine.
GCC and MSVC both accept this code.
Godbolt reproducer.
The text was updated successfully, but these errors were encountered: