CTAD for alias template

3 days ago 8
ARTICLE AD BOX
template<typename T, bool IsConst> class PtrC { public: constexpr PtrC(const T* const p) : ptr{p} {} constexpr auto getMutable() requires(not IsConst) { return const_cast<T*>(ptr); } public: const T* ptr; }; template<typename T> PtrC(T* const) -> PtrC<T, false>; template<typename T> PtrC(const T* const) -> PtrC<T, true>; template<typename U, bool IsConst> using Ptr2PtrC = PtrC<U* const, IsConst>; auto main() -> int { Ptr2PtrC ptr2ptrc{new int* const{nullptr}}; }

This code compiles with GCC 15.2 but is rejected by Clang 21.1.0

Which is correct and why? How does CTAD work for the second template parameter isConst in my case? How are the deduction guides transformed for the alias template?
Read Entire Article