Aggregate initialization of function template arguments with automatic template type deduction

Here’s the setup to illustrate the problem.

template <typename T>
struct opt {
  const char* name;
  T x;

  template <typename X>
  opt(const char* name, X&& x)
  : name(name), x(std::forward<X>(x)) { }

template <typename T>
opt(const char*, T&&) -> opt< some_type_transformation<T> >;

template <typename... T>
void function(opt<T>&&... opts) {
  // do something with the passed arguments

With this, the following syntax can be used.


But the following does not work.


Theoretically, there is enough information to figure out what to do in the second case, since the function takes arguments only of type opt<T>, and T can be deduced using the defined deduction guide.

Can something be done to enable the second, terser syntax?

Source: Windows Questions C++