From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D5359399C002; Wed, 9 Jun 2021 16:56:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5359399C002 From: "nickolay.merkin at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100825] function signature constraints are not a part of mangled name Date: Wed, 09 Jun 2021 16:56:35 +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: 11.1.0 X-Bugzilla-Keywords: ABI, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: nickolay.merkin at gmail dot com 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: cc 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, 09 Jun 2021 16:56:35 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100825 Nickolay Merkin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nickolay.merkin at gmail d= ot com --- Comment #8 from Nickolay Merkin --- (In reply to Jonathan Wakely from comment #3) > Clang and EDG agree with GCC here. >=20 > I think your code is ill-formed due to [temp.constr.atomic] p3: >=20 > "If, at different points in the program, the satisfaction result is > different for identical atomic constraints and template arguments, the > program is ill-formed, no diagnostic required." Of course the constraints are different! First constraint is empty, second = is always-true. So, these are different overloads. Okay, let's help the compiler giving different mangled names: https://gcc.godbolt.org/z/K8d9vv8oT namespace a {} namespace b {} using namespace a; using namespace b; namespace a { template void f() { std::cout << __PRETTY_FUNCTION__ << std::endl;= } } void g() { f(); } namespace b { template void f() requires true { std::cout << __PRETTY_FUNCTION__= << std::endl; } } void h() { f(); } g addresses to a::f, h addresses to b::f. Is this still "ill-formed, no diagnostics required"? Does it mean that a compiler may produce any corrupted binary code with any undefined behavior? Just because we wrote same "f()" both times? I believe, not, it does not. The program is well-formed. Both overloads are valid. And both are different, - it is not an ODR violat= ion. So, the issue is on the compiler's side: wrong rules of mangling.=