From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 43683385843A; Wed, 8 Dec 2021 15:49:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 43683385843A From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99186] std::tuple compilation error when elements are specializations of template class declared with template < auto E > syntax with E being a enumerator of a enum Date: Wed, 08 Dec 2021 15:49:26 +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: redi at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords 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: Wed, 08 Dec 2021 15:49:26 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99186 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|diagnostic | --- Comment #5 from Jonathan Wakely --- Reduced to remove the library dependency: template struct tuple_impl : tuple_impl { }; template struct tuple_impl { }; template struct tuple : tuple_impl<0, T, U> { }; template void get(const tuple_impl&) { } enum class E1 {a}; enum class E2 {b,c}; template < auto > struct S { int i; }; int main() { tuple,S> x; get>(x); // does not compile } Clang and EDG compile this, G++ has a bogus ambiguity: ambig.C: In function =E2=80=98int main()=E2=80=99: ambig.C:28:18: error: invalid initialization of reference of type =E2=80=98= const tuple_impl<0, S, S >&=E2=80=99 from expression of type =E2=80= =98tuple, S >=E2=80=99 28 | get>(x); // does not compile | ^ ambig.C:13:5: note: in passing argument 1 of =E2=80=98void get(const tuple_= impl&) [with T =3D S; int N =3D 0; U =3D {S}]=E2=80=99 13 | get(const tuple_impl&) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The bug is that S and S are distinct types but the compiler g= ets them confuses. We have several bugs about template types that get confused.=