[all-commits] [llvm/llvm-project] 6dcb60: [clang] Implement `__is_pointer_interconvertible_b...

Vlad Serebrennikov via All-commits all-commits at lists.llvm.org
Fri Apr 12 22:00:38 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6dcb60481323c871556a5a14ed887a5867ece114
      https://github.com/llvm/llvm-project/commit/6dcb60481323c871556a5a14ed887a5867ece114
  Author: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
  Date:   2024-04-13 (Sat, 13 Apr 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/TokenKinds.def
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaChecking.cpp
    M clang/lib/Sema/SemaExprCXX.cpp
    M clang/test/SemaCXX/type-traits.cpp

  Log Message:
  -----------
  [clang] Implement `__is_pointer_interconvertible_base_of()` (#88473)

This patch implements intrinsic that supports
`std::is_pointer_interconvertible_base_of` type trait from
[P0466R5](https://wg21.link/p0466r5) "Layout-compatibility and
Pointer-interconvertibility Traits".

Normative wording:
> Comment: If `Base` and Derived are non-union class types and are not
(possibly _cv_-qualified) versions of the same type, `Derived` is a
complete type.
> Condition: `Derived` is unambiguously derived from `Base` without
regard to _cv_-qualifiers, and each object of type `Derived` is
pointer-interconvertible (6.7.2 [basic.compound]) with its `Base`
subobject, or `Base` and `Derived` are not unions and name the same
class type without regard to _cv_-qualifiers.

The paper also express the following intent:
> Note that `is_pointer_interconvertible_base_of_v<T,T>` is always true
under this wording, even though `T` is not derived from itself.

I find the treatment of unions in the wording contradictory to this
intent, and I'm not able to find anything relevant in minutes or on the
reflector. That said, this patch implements what the wording says, since
it's very explicit about unions.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list