1

LiveDemo: https://godbolt.org/z/daP7c8av6

template<typename T>
struct A {
    A(T);
};

// OK
template<typename T>
A(T&&) -> A<T&&>;

template<typename T>
struct B {
  B(T);
};

// GCC&Clang: OK
// MSVC: error C3539: a template-argument cannot be a type that contains 'auto'
B(auto&& ref) -> B<decltype(ref)>;
VainMan
  • 2,025
  • 8
  • 23

0 Answers0