From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 08B4638930D3; Fri, 12 Feb 2021 05:00:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 08B4638930D3 From: "jason at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96926] [9/10/11 Regression] Tuple element w/ member reference to incomplete template type rejected Date: Fri, 12 Feb 2021 05:00:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.2.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: jason at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: jason at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Feb 2021 05:00:19 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96926 --- Comment #4 from Jason Merrill --- Further reduced: template struct A { using type =3D typename T::type; }; template class B { template ::type X> B(U); }; struct C { B b; C(); }; int main() { C c; } We run into trouble trying to implicitly declare the copy constructor for C, which involves overload resolution to find the constructor called for copyi= ng B. After r262172, when we consider the constructor template, we try to substit= ute the default template argument for V into the type of X, which involves instantiating A, which fails. Before r262172, we would see that we ca= n't convert B to int, and give up on the candidate before getting to this substitution. But r262172 moves the convertibility checking until after we= 're done with deduction, as per http://wg21.link/cwg2369 I think perhaps it's wrong to do substitution at this point because X has no default argument. Giving it a default argument causes clang 10 to also rej= ect the testcase.=