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

            Bug ID: 64261
           Summary: false branch of conditional operator ?: evaluated in a
                    template constexpr
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eugene at hutorny dot in.ua

Created attachment 34245
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34245&action=edit
Code sample illustrating the problem

When a conditional (ternary) operator is used in a constexpr function in a
template, compiler evaluates both true and false branches, causing undesired
side-effects, such as division by zero.

Please refer to attached example

Reply via email to