[all-commits] [llvm/llvm-project] caa902: [clang] Allow constexpr cast from `void*` in more ...

offsetof via All-commits all-commits at lists.llvm.org
Mon Apr 29 06:24:12 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: caa902613a96f63c3855b3a0bcd82d1b1db49408
      https://github.com/llvm/llvm-project/commit/caa902613a96f63c3855b3a0bcd82d1b1db49408
  Author: offsetof <131769984+offsetof at users.noreply.github.com>
  Date:   2024-04-29 (Mon, 29 Apr 2024)

  Changed paths:
    M clang/lib/AST/ExprConstant.cpp
    M clang/test/CXX/drs/dr25xx.cpp
    M clang/test/CXX/drs/dr28xx.cpp
    M clang/test/CXX/expr/expr.const/p5-26.cpp
    M clang/www/cxx_dr_status.html
    M clang/www/make_cxx_dr_status

  Log Message:
  -----------
  [clang] Allow constexpr cast from `void*` in more cases (#89484)

[[expr.const]/5.14](https://eel.is/c++draft/expr.const#5.14) says that
constexpr cast from <code>*cv* void\*</code> to `T*` is OK if the
pointee type is similar to `T`, but Clang currently only permits the
conversion if the types are the same except top-level cv-qualifiers.

This patch also allows casting `(void*)nullptr`, implementing the
resolution of [CWG2819](https://cplusplus.github.io/CWG/issues/2819).

---------

Co-authored-by: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>



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