From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B31063858D20; Fri, 2 Aug 2024 17:29:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B31063858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1722619751; bh=WBIUtGjZitbpWLnXCZ7wExIm+MaoTub/NN4J91lqNVM=; h=From:To:Subject:Date:From; b=O55m2G2lM9chHoMhKSLvTZgvi1OjDFtTcdkGVHe44jBjuzywBZTIcuqbG4hQhY65c AA1Eh6jfhVxGdxWPq+BuxbteN+aStHA9cjtN9gRRfEKmcb6h0GDny6G8V0CYmKDToD PevLuHlzHg9nFl9eYI53fn6MuyTY8/HkDL+F1MXo= From: "rsaxvc at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/116198] New: Wdeprecated-enum-enum-conversion triggers inside extern "C" Date: Fri, 02 Aug 2024 17:29:11 +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: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rsaxvc 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D116198 Bug ID: 116198 Summary: Wdeprecated-enum-enum-conversion triggers inside extern "C" Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rsaxvc at gmail dot com Target Milestone: --- deprecated-enum-enum-conversion warnings apply to C code compiled by G++, should they? I'm assuming if this code would not trigger a warning in C, it shouldn't trigger a warning in extern "C". Here's a minimal contrived examp= le: #include extern "C"{ enum {TWO =3D 2}; enum {ONE =3D 1}; void * triggerDeprecatedEnumConversion() { return malloc(ONE | TWO); } } When the above code is compiled with g++ 12.2.0, -Wall -Wextra -O2 -std=3Dc= ++23, triggers this warning: : In function 'void* triggerDeprecatedEnumConversion()': :17:27: warning: bitwise operation between different enumeration types '' and '' is deprecated [-Wdeprecated-enum-enum-conversion] 17 | return malloc(ONE | TWO); | ~~~~^~~~~ One real-world use-case this impacts occurs in LVGL, which uses separate en= ums for different parts of a bitfield that are then combined in functions in a header, so every C++ file that includes those headers triggers this warning. Related discussion here: https://github.com/lvgl/lvgl/issues/5119 Specific compiler version: xtensa-esp32s3-elf-c++.exe (crosstool-NG esp-12.2.0_20230208) 12.2.0 Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is = NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPO= SE.=