https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104787
Bug ID: 104787 Summary: [12 Regression] False positive -Wreturn-type since r12-5638-ga3e75c1491cd2d50 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: jason at gcc dot gnu.org Target Milestone: --- Similarly to PR103597, the following triggers false positive without an optimization level (reduced from godot game engine): $ cat godot.ii struct String { String(const char *); }; struct FileAccessRef { FileAccessRef(int); ~FileAccessRef(); }; struct OS_LinuxBSD { String get_processor_name() const; }; String OS_LinuxBSD::get_processor_name() const { FileAccessRef f = 0; if (true) return ""; } $ g++ godot.ii -Werror=return-type -c godot.ii: In member function ‘String OS_LinuxBSD::get_processor_name() const’: godot.ii:15:1: error: control reaches end of non-void function [-Werror=return-type] 15 | } | ^ cc1plus: some warnings being treated as errors