Minimal example: https://godbolt.org/z/P86MY1ccz Compiles fine with clang. Compiles with gcc if you specify `Test<int>`, though the deduction guide should make them equivalent. Possibly related to Bug 93425
template<template<typename...> typename Template, typename... Args> struct _dummy_forwarder { using type = Template<Args...>; }; template<template<typename...> typename Template, typename... Args> using dummy_forwarder = typename _dummy_forwarder<Template, Args...>::type; template<typename T> struct Test { template<typename U> using _dummy = U; using Element = dummy_forwarder<_dummy, T>; Element _elem; constexpr Test(const Element elem) : _elem(elem) { } }; template<typename T> Test(T) -> Test<T>; consteval void test() { const auto t = Test(1); }
Confirmed.
Started with r11-2748.
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:b854ce130ebbfdf2f882ef08538746030513b44b commit r12-7853-gb854ce130ebbfdf2f882ef08538746030513b44b Author: Jason Merrill <jason@redhat.com> Date: Sat Mar 26 23:54:22 2022 -0400 c++: CTAD and member alias template [PR102123] When building a deduction guide from the Test constructor, we need to rewrite the use of _dummy into a dependent reference, i.e. Test<T>::template _dummy. We were using SCOPE_REF for both type and non-type templates; we need to use UNBOUND_CLASS_TEMPLATE for type templates. PR c++/102123 gcc/cp/ChangeLog: * pt.cc (tsubst_copy): Use make_unbound_class_template for rewriting a type template reference. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/class-deduction110.C: New test.
The releases/gcc-11 branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:e952290874d6b99946dc02e125c0fb0e9b13a1e3 commit r11-9703-ge952290874d6b99946dc02e125c0fb0e9b13a1e3 Author: Jason Merrill <jason@redhat.com> Date: Sat Mar 26 23:54:22 2022 -0400 c++: CTAD and member alias template [PR102123] When building a deduction guide from the Test constructor, we need to rewrite the use of _dummy into a dependent reference, i.e. Test<T>::template _dummy. We were using SCOPE_REF for both type and non-type templates; we need to use UNBOUND_CLASS_TEMPLATE for type templates. PR c++/102123 gcc/cp/ChangeLog: * pt.c (tsubst_copy): Use make_unbound_class_template for rewriting a type template reference. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/class-deduction110.C: New test.
Fixed.