https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116952
Giel <giel+gcc at mortis dot eu> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |giel+gcc at mortis dot eu
--- Comment #3 from Giel <giel+gcc at mortis dot eu> ---
I just ran into the same issue when trying to create meta-concepts and used
lambdas to approximate 'concept template parameters':
https://godbolt.org/z/5qaradfeE
```
#include <concepts>
// Convert a concept to a functor that can be passed as an NTTP
#define CONCEPTARG(C, ...) \
([] <typename _first_concept_arg_> () consteval \
{ return C<_first_concept_arg_ __VA_OPT__(,) __VA_ARGS__>; })
// Convert functor NTTP back to concept
template <typename T, auto ConceptParam>
concept apply_concept_fun = ConceptParam.template operator()<T>();
// Example meta-concept that combines others
template <typename T, auto... Concepts>
concept all_of = (apply_concept_fun<T, Concepts> && ...);
template <all_of<CONCEPTARG(std::integral), CONCEPTARG(std::constructible_from,
int)> I>
constexpr auto foobar(I i)
{
return i * static_cast<I>(2);
}
```
Note that funnily enough just moving the concept check to a `requires` clause
causes compilation to pass:
```
template <typename I>
requires all_of<I, CONCEPTARG(std::integral),
CONCEPTARG(std::constructible_from, int)>
constexpr auto foobar(I i)
{
return i * static_cast<I>(2);
}
```