https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115198
Bug ID: 115198 Summary: Class template argument deduction fails for copy ctor when used with an alias template if the aliased class template has explicitly defaulted copy ctor Product: gcc Version: 14.1.0 URL: https://sigcpp.godbolt.org/z/jjGT8hK8d Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: s.murthy at outlook dot com Target Milestone: --- Class template argument deduction fails when the copy ctor is used with an alias template if the aliased class template has explicitly defaulted copy ctor. The error disappears if the explicit defaulted copy ctor is removed (i.e. have the compiler include the implicitly declared copy ctor). See repro but I believe this issue manifests at least under the following conditions: - All parameters of the alias template have default values - The copy ctor is used using the alias template without any arguments for the template parameters and without angle brackets (as you would with a class directly). The issue is seen in GCC 10.1 to 14.1 (since C++20s support). I have confirmed that trunk too has this issue as of this writing. In comparison Clang trunk (post 18.1) does *not* have this issue. PS: Please forgive me if this report does not meet expectations. This is my first time filing an issue here. Also, my search of the issues did not show another matching issue (and thus my filing). A repro with different scenarios is at: https://sigcpp.godbolt.org/z/jjGT8hK8d //repro in short template<bool B = false, typename T = int> class C1 { public: C1() = default; C1(const C1& other) = default; }; template<typename T = int> using A1 = C1<false, T>; C1 c1; A1 a1(c1); //Error //same as C1 but with implict copy ctor template<bool B = false, typename T = int> class C2 { public: C2() = default; }; template<typename T = int> using A2 = C2<false, T>; C2 c2; A2 a2(c2); //OK