I'm writing a deduction guide in the style of an abbreviated function template, but I'm not sure if it's allowed. It compiles on gcc and clang, but not msvc.
The error is:
error C3539: a template-argument cannot be a type that contains 'auto'
Which compiler is doing the right thing?
template <typename Type, int Count>
struct Array
{
Type data[Count];
Array (auto ... arg)
{
int count = 0;
((data[count++] = arg),...);
}
};
// abbreviated function template syntax - fails in msvc
Array (auto first, auto ... next) -> Array<decltype(first), 1 + sizeof...(next)>;
// regular syntax
// template <typename Type, typename ... Args> Array (Type first, Args ... next) -> Array<Type, 1 + sizeof...(Args)>;
int main ()
{
Array a(1,2,3);
}