From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6C9CB384F6F9; Sat, 19 Nov 2022 19:14:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6C9CB384F6F9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668885299; bh=4NrUSqHzSeMVP+eWuQrpCbw29gDhXz70YX1W2EOPMBs=; h=From:To:Subject:Date:From; b=KjtLsMLDKSpAGi+Ie55ao96SMpCF5dSL8ZjBmnjpNuK3/Y3F6EYe0E5Hvaw53oeyv CmojN5de0f83Ck7PMq/widBsKQ+A+HAvEndd2YULfAMk6RD6TfqSj4SgCveKx/dKZM GiyuXNEQqIx5p60idduomjdx8nzGJP7CZrMP6C9E= From: "lebedev.ri at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/107763] New: -Wreturn-type false-positive with fully-covered switch over enum Date: Sat, 19 Nov 2022 19:14:50 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: lebedev.ri 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=3D107763 Bug ID: 107763 Summary: -Wreturn-type false-positive with fully-covered switch over enum Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: lebedev.ri at gmail dot com Target Milestone: --- enum a { b }; int foo(a a) { switch(a) { case b: return 42; } } The `a` can only have value `a::b`, so the function always returns 42, yet gcc complains: > warning: control reaches end of non-void function [-Wreturn-type] https://godbolt.org/z/j8ezrr5h3=