https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122088

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
GCC 15 just says:

122088.cc:13:9: error: expected ‘)’ before ‘...’ token
   13 | Bar(Args...) -> Bar<std::common_type_t<Args...>>;
      |    ~    ^~~
      |         )
122088.cc: In function ‘int main()’:
122088.cc:16:11: error: class template argument deduction failed:
   16 |   Bar b{42};
      |           ^


Clang's error is more helpful:

122088.cc:13:1: error: cannot specify deduction guide for alias template 'Bar'
   13 | Bar(Args...) -> Bar<std::common_type_t<Args...>>;
      | ^
122088.cc:10:1: note: template is declared here
   10 | using Bar = std::variant<Foo<T>>;
      | ^
122088.cc:13:1: error: declarator requires an identifier
   13 | Bar(Args...) -> Bar<std::common_type_t<Args...>>;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
122088.cc:16:7: error: no viable constructor or deduction guide for deduction
of template arguments of 'Bar'
   16 |   Bar b{42};
      |       ^


Even if you _could_ define a deduction guide for an alias template, doing so
for std::variant would be ill-formed because you don't own that type.

Reply via email to