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

            Bug ID: 82541
           Summary: Wduplicated-branches triggers in template context
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andreas.pokorny at siemens dot com
  Target Milestone: ---

template<int N>
struct AR
{
    char bla[N > 0 ? N : 1];
};

int main() {
    AR<1> warning;
}

When built with -Wduplicated-branches this triggers a warning. This is most
visible with fmtlib: 

https://github.com/fmtlib/fmt/blob/master/fmt/format.h#L2328

There is currently a workaround in place but the fact that this workaround
(using +1 instead of 1) works seems to be another bug.

Reply via email to