https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107763

            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

Reply via email to