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

            Bug ID: 101087
           Summary: Unevaluated operand of sizeof affects noexcept
                    operator
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rkhlebnikov at bloomberg dot net
  Target Milestone: ---

clang, icc, MSVC all agree that the following `static_assert` should pass:

```
int f();
static_assert(noexcept(sizeof(f())), "");  // Fails on GCC
```

Such is not the case for gcc.

However, adding `decltype` to the mix helps:

```
int f();
static_assert(noexcept(sizeof(decltype(f()))), "");  // OK
```

Reply via email to