-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Closed
Bug
Copy link
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsC++20 conceptslambdaC++11 lambda expressionsC++11 lambda expressionsregression
Description
Reproducer:
template <class T>
struct type_identity {
using type = T;
};
template <typename Inner>
struct Cat {};
template <typename T>
concept CatConcept = requires {
[]<class Inner>(type_identity<Cat<Inner>>) {}(type_identity<T>{});
};
template <typename Dummy>
struct Feeder {
template <CatConcept Dummy2>
void feed() noexcept {}
};
int main() { Feeder<int>{}.feed<Cat<int>>(); }
Error:
<source>:20:28: error: no matching member function for call to 'feed'
20 | int main() { Feeder<int>{}.feed<Cat<int>>(); }
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
<source>:17:10: note: candidate template ignored: constraints not satisfied [with Dummy2 = Cat<int>]
17 | void feed() noexcept {}
| ^
<source>:16:15: note: because 'Cat<int>' does not satisfy 'CatConcept'
16 | template <CatConcept Dummy2>
| ^
<source>:11:5: note: because '[]<class Inner>(type_identity<Cat<Inner>>) {
}(type_identity<T>{})' would be invalid: no matching function for call to object of type '(lambda at <source>:11:5)'
11 | []<class Inner>(type_identity<Cat<Inner>>) {}(type_identity<T>{});
| ^
1 error generated.
Compiler returned: 1
Godbolt: https://godbolt.org/z/bMYnWs6Kx
The code works with clang-21 and GCC.
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsC++20 conceptslambdaC++11 lambda expressionsC++11 lambda expressionsregression