Is there a (clean) work-around to Clang's behavior "undefined template smthg<auto>" ?
Code example :
- https://godbolt.org/z/GGs7ndKE4 (see below for copy/paste)
Additional insight :
- This issue is not reproductible with GCC nor MSVC/CL,
thus only affect clang and clang-cl - Clang-cl add the following error message :
error : cannot mangle this 'auto' type yet
What I'd expect is that, according the example provided above, to get respectively two types with the same - evaluatable - std::tuple_size_v :
class std::tuple<
struct std::integral_constant<bool,0>,
struct std::integral_constant<bool,1>,
struct std::integral_constant<bool,0>
>
class std::tuple<bool,bool,bool>
Am I missing a point?
Code example :
#include <tuple>
#include <array>
#include <type_traits>
template <template <typename> class trait, typename... Ts>
struct trait_result {
template <template <typename...> class T>
using as_t = T<typename trait<Ts>::type...>;
template <template <typename...> class T>
constexpr static auto as_v = T{trait<Ts>::value...};
using as_tuple_t = as_t<std::tuple>;
constexpr static auto as_tuple_v = std::tuple{trait<Ts>::value...};
};
namespace test
{
template <typename T>
using is_int = std::is_same<int, T>;
using results = trait_result<is_int, char, int, bool>;
using results_as_tuple = results::as_t<std::tuple>; // ok
using results_as_tuple_value_type = std::decay_t<decltype(results::as_v<std::tuple>)>; // ko
static_assert(std::tuple_size_v<results_as_tuple> == std::tuple_size_v<results_as_tuple_value_type>);
}