clang-concepts-monorepo
clang-concepts-monorepo copied to clipboard
auto type deduction
Maybe my understanding of concepts is not good enough, but I'm having this issue. https://godbolt.org/z/ThKZu5 As seen in the example parameter declared as Employee auto && is deduced as Employee auto (because of std::decay_t) instead of CT::CTEmployee. The commented out version works fine, where concepts are template parameters. So my question is does the type deduction not happen here? Or better when does evaluation of concepts happen?
Please verify, if I correctly minimized your example to pin down the issue. https://godbolt.org/z/OzT00u
Yes, that's about it (sorry I didn't post something like this originally).
Don't know if it helps but having a concrete type, or template argument, as type for the first parameter works fine.
eg.
template<typename T> void fun(T&& x, Bar<std::decay_t<decltype(x)>> auto & y);
template <Foo F> void fun(F&& x, Bar<std::decay_t<decltype(x)>> auto & y) { }
void fun(FooImpl & x, Bar<std::decay_t<decltype(x)>> auto & y);
So it seems that it's auto that's causing issues.