From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D357A385DC14; Wed, 10 Jun 2020 18:29:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D357A385DC14 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1591813757; bh=xDz0+bSMaYlVjDft9Ni48oipDWxa64y4jEFUJv8Ufyg=; h=From:To:Subject:Date:From; b=ru8FEzLe4aiIM2/L7CUw+F7QpwvrDUNSX/5ZtSekTSFWX3vFEvf0DWvvq48jjUcSL JpJbM/YlPqRz0wdhDwNL3RQdF/FfvPr7MfY5aTdefJGnCfR7u4ROtGvbj2OgDvLger UzOWoxTCloV7Lr8Br0eIi4SPNi1JL4IDH4U39DbM= From: "godeffroy.valet at m4x dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95626] New: [concepts] incorrect ambiguous overload with constraints "A && !B" vs "!B" Date: Wed, 10 Jun 2020 18:29:17 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: godeffroy.valet at m4x dot org X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: 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, 10 Jun 2020 18:29:17 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95626 Bug ID: 95626 Summary: [concepts] incorrect ambiguous overload with constraints "A && !B" vs "!B" Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: godeffroy.valet at m4x dot org Target Milestone: --- Created attachment 48715 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D48715&action=3Dedit preprocessed source code The following code fails to compile, giving an "ambiguous overload" error w= hile one function is clrearly more constrined than the other. //////////////////////////////////////////////////////////////// #include template concept ConceptA=3Dstd::is_same::value; template concept ConceptB=3Dstd::is_same::value; template requires (!ConceptB && ConceptA) auto constexpr test__(A const& ){ } template requires (!ConceptB) auto constexpr test__(A const& ){ } int main(){ test__(2); // error } //////////////////////////////////////////////////////////////// Note that the negation in "!ConceptB" is required to reproduced the issu= e. In particular, the following code compiles. //////////////////////////////////////////////////////////////// #include template concept ConceptA=3Dstd::is_same::value; template concept ConceptB=3D!std::is_same::value; template requires (ConceptB && ConceptA) auto constexpr test__(A const& ){ } template requires (ConceptB) auto constexpr test__(A const& ){ } int main(){ test__(2); // OK } //////////////////////////////////////////////////////////////// Command used : g++ -std=3Dc++2a -Wall -Wextra test.cpp Output : geometry/algebra/definition.test.cpp: In function 'int main()': geometry/algebra/definition.test.cpp:23:10: error: call of overloaded 'test__(int)' is ambiguous 23 | test__(2); | ^ geometry/algebra/definition.test.cpp:10:17: note: candidate: 'constexpr auto test__(const A&) [with A =3D int]' 10 | auto constexpr test__(A const& ){ | ^~~~~~ geometry/algebra/definition.test.cpp:14:17: note: candidate: 'constexpr auto test__(const A&) [with A =3D int]' 14 | auto constexpr test__(A const& ){ | ^~~~~~ Output of gcc -v : Utilisation des specs internes. COLLECT_GCC=3Dg++ COLLECT_LTO_WRAPPER=3D/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/lto-wrapper Cible : x86_64-pc-linux-gnu Configur=C3=A9 avec: /build/gcc/src/gcc/configure --prefix=3D/usr --libdir= =3D/usr/lib --libexecdir=3D/usr/lib --mandir=3D/usr/share/man --infodir=3D/usr/share/in= fo --with-bugurl=3Dhttps://bugs.archlinux.org/ --enable-languages=3Dc,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl --with-linker-hash-style=3Dgnu --with-system-zlib --enable-__cxa_atexit --enable-cet=3Dauto --enable-checking=3Drelease --enable-clocale=3Dgnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-install-libiberty --enable-linker-build= -id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=3Dposix --disable-libssp --disable-libstdcxx-pch --disable-libunwind-exceptions --disable-werror gdc_include_dir=3D/usr/include/dlang/gdc Mod=C3=A8le de thread: posix Algorithmes de compression LTO support=C3=A9s: zlib zstd gcc version 10.1.0 (GCC)=