https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99103
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:676f6f3277181662cf3ed07769edfa2d4fb7df28 commit r11-7405-g676f6f3277181662cf3ed07769edfa2d4fb7df28 Author: Patrick Palka <ppa...@redhat.com> Date: Thu Feb 25 16:38:08 2021 -0500 c++: Fix CTAD of single-element initializer list [PR99103] When determining whether to rule out initializer-list constructors during CTAD with a single-element initializer list (as per P0702), the element type's cv-qualifiers should be irrelevant. This patch fixes this by making is_spec_or_derived strip cv-qualifiers from the supplied expression type. In passing, I noticed in maybe_aggr_guide we were calling is_spec_or_derived with swapped arguments. This led us to prefer the aggregate deduction candidate over copying deduction in the second testcase below with -std=c++20. gcc/cp/ChangeLog: PR c++/99103 * pt.c (is_spec_or_derived): Drop cv-qualifiers from 'etype'. (maybe_aggr_guide): Fix order of arguments to is_spec_or_derived. gcc/testsuite/ChangeLog: PR c++/99103 * g++.dg/cpp1z/class-deduction79.C: New test. * g++.dg/cpp1z/class-deduction80.C: New test.