This program: ``` struct A{}; struct B : A { A a; }; int main() { constexpr B b{}; static_assert( &static_cast<const A&>(b) < &b.a ); } ``` is accepted by GCC, but Clang rejects it with the error: ``` comparison of address of base class subobject 'A' of class 'B' to field 'a' has unspecified value ``` Demo: https://gcc.godbolt.org/z/9G8szToPz It looks like Clang is right here, and this indeed must be rejected.
Confirmed. ICC also rejects this code with the following error message: <source>(7): note: pointer values cannot be compared because they do not point into the same complete object or they point to subobjects with different accessibility Note MSVC "accepts" it (if you change < to <= so the static_assert is ok).