This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2026-05-05


3188. Behavior change for class template argument deduction

Section: C.2  [diff.cpp20]     Status: open     Submitter: Christof Meerwald     Date: 2026-04-30

Consider:

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

   template<typename T>
   struct D : B<T *> {
     D(T);
     using B<T *>::B;
     T m = "a";   // #1
   };

   D d("");       // #1 is OK with C++20 (T deduced as const char*), but ill-formed with C++23 (T deduced as const char)

Possible resolution:

Add a new subclause in C.2 [diff.cpp20] as follows:

C.2.5+ Clause 12: overloading [diff.cpp20.over]

Affected subclause: 12.2.2.9 [over.match.class.deduct]
Change: Deducing class template arguments from inherited constructors.
Rationale: Adding missing feature for class template argument deduction.
Effect on original feature: Valid ISO C++ 2020 code may become ill-formed or change meaning.
[Example 1 :
   template<typename T>
   struct B {
     B(T);
   };

   template<typename T>
   struct D : B<T *> {
     D(T);
     using B<T *>::B;
     T m = "a";   // #1
   };

   D d("");       // ill-formed at #1 (T deduced as const char); previously well-formed (T deduced as const char*)
-- end example]