[Bug c++/87603] New: [C++17] noexcept isn't special cased for constant expressions anymore

miguel.ojeda.sandonis at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Oct 13 01:08:00 GMT 2018


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

            Bug ID: 87603
           Summary: [C++17] noexcept isn't special cased for constant
                    expressions anymore
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: miguel.ojeda.sandonis at gmail dot com
  Target Milestone: ---

CWG 1129 (which ended up in C++11) added a special case to noexcept for
constant expressions, so that:

    constexpr void f() {} static_assert(noexcept(f()));

CWG 1351 (which ended up in C++14) changed the wording significantly, but the
special case remained, in a different form.

P0003R5 (which ended up in C++17) changed the wording again, but the special
case was removed (by accident), so now:

    constexpr void f() {} static_assert(!noexcept(f()));

According to Richard Smith in LLVM 15481, CWG discussed this but decided to
keep the behavior as-is. Currently, clang does the right thing for C++17 (and
fails for C++14 and C++11, on purpose). g++, however, implemented the special
case for C++11 already, but not the change for C++17. Currently, icc and msvc
seem to behave like g++.


More information about the Gcc-bugs mailing list