This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/82541] New: Wduplicated-branches triggers in template context


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]