From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B30573845BE1; Fri, 5 Apr 2024 13:13:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B30573845BE1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712322826; bh=pEdSpuSNl9oYjQjlIDqqgb1vEW+MG9FQxwPoUIrrgiE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MzF0gqv9UaNYsgQCtjmVbMTnyifnuTuwCiIr2lpJZ5ZcFy8cSYwQsJRyzdwOXtPZ3 lJFp//I+d7bWpEfx4KC9rlcqa7RbKHo2X5Tiq3tCHHN6ia0YkYJOFeqamRMXAb0G90 asklLMqEVuDc2O+UgcBfAldPeROBUGooWMrxEl3c= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/114602] Compilcation failure when using a user-defined function which name is same as a posix function Date: Fri, 05 Apr 2024 13:13:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: DUPLICATE 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: resolution bug_status 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114602 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |DUPLICATE Status|UNCONFIRMED |RESOLVED --- Comment #1 from Jonathan Wakely --- This is a longstanding issue that glibc headers expose all APIs when includ= ed from C++ code. You can either cast the function pointer to the right type: std::sort(ptr, ptr, static_cast(bcmp)); or use a lambda expression: std::sort(ptr, ptr, [](foo l, foo r) { return bcmp(l, r); }); *** This bug has been marked as a duplicate of bug 11196 ***=