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

--- Comment #3 from Steven Sun <StevenSun2021 at hotmail dot com> ---
By the way, in the current design, the class definition is passed twice in
order we can see every member data/function declaration before parsing NSDMI
and member functions.

The class is complete after parsing all declaration, which means `&C::f ==
nullptr` can reduce to false since that.

So, under current design, the following code compiles on GCC.
https://godbolt.org/z/fMTsf4KoM

```
struct C {
  C() {
    static_assert(&C::f != 0);  // complete type
  }
  void f() noexcept(&C::f != 0) {
    static_assert(&C::f != 0);  // complete type
  }
  static_assert(__builtin_constant_p(&C::f));        // incomplete type
  static_assert(!__builtin_constant_p(&C::f == 0));  // incomplete type
};

static_assert(&C::f != 0);  // complete type

```

Reply via email to