From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 704043858D3C; Mon, 14 Feb 2022 20:02:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 704043858D3C From: "johnsen.david at siemens dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/104534] New: write-strings does not follow C++ standard Date: Mon, 14 Feb 2022 20:02:04 +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.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: johnsen.david at siemens 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 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: Mon, 14 Feb 2022 20:02:04 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104534 Bug ID: 104534 Summary: write-strings does not follow C++ standard Product: gcc Version: 10.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: johnsen.david at siemens dot com Target Milestone: --- The bug is present in all versions of GCC from 6 to 11 and on GCC trunk. example file ws.cpp: #include void f(char*) { std::cout << "This compiler is broken" << std::endl; } void f(bool) { std::cout << "This compiler is correct" << std::endl; } int main() { f("This is supposed to work"); return 0; } This program is a valid C++ and the standard is very clear on what the resu= lt should be. As far as I know, there is no way to make GCC generate this result. compiled with: c++ ws.cpp Depending on the command line options, the program can: * compile (and run incorrectly, -Wnowrite-strings), * compile with a warning (still run incorrectly, -Wwrite-strings), * or not compile at all (-Werror -Wwrite-strings). The only outcome that I can't get is the correct one: * The program compiles without errors and runs correctly. Other compilers, such as clang++ and Visual Studio C++, follow the standard= .=