https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116005
Bug ID: 116005 Summary: Class template argument deduction for alias templates error in C++20 Product: gcc Version: 14.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: raplonu.jb at gmail dot com Target Milestone: --- Hi, the following code does not compile with gcc 14 & c++20. template <typename T1, typename T2> struct A { template <typename U> A(const std::vector<U> &arr) {} }; template <typename T1, typename T2> A(std::vector<T1> const &) -> A<const T1, T2>; template <typename T> using B = A<T, void>; int main() { const std::vector<int> v; B b{v}; } It gives the following error message: <source>:19:10: error: class template argument deduction failed: 19 | B b{v}; | ^ <source>:19:10: error: no matching function for call to 'A(const std::vector<int>&)' <source>:11:1: note: candidate: 'template<class T1, class T2> A(const std::vector<T1>&)-> A<const T1, T2> requires __is_deducible (B, A<const T1, T2>)' 11 | A(std::vector<T1> const &) -> A<const T1, T2>; | ^ <source>:11:1: note: template argument deduction/substitution failed: <source>:19:10: note: couldn't deduce template parameter 'T2' 19 | B b{v}; | ^ I believe this code is valid and should compile. Also, I notice with gcc 13 and above, it works if I replace `const T1` by `std::add_const_t<T1>` in the deduction guide (or if I remove all const keywords) repro: https://godbolt.org/z/E5fE53oe1 Thanks for your time