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

            Bug ID: 97237
           Summary: [10/11 Regression] static_assert does not accept
                    fpermissive code
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lutztonineubert at gmail dot com
  Target Milestone: ---

The following valid code:

  constexpr bool test() {
      auto i = 1 << 132;
      return true;
  }

  static_assert(test());

Build with GCC -fpermissive does compile in GCC 9 but not in 10/11:

> non-constant condition for static assertion

See: https://gcc.godbolt.org/z/r85zvP

But this code is valid in all versions:

  constexpr bool test() {
      auto i = 1 << 132;
      return true;
  }

  constexpr auto t = test();

  static_assert(t);

Reply via email to