[clang] [Clang][C++20] Implement constexpr std::bit_cast for bit-fields (& [Sema] Print more static_assert exprs) (PR #74775)

2023-12-08 Thread via cfe-commits
sethp wrote: Easy enough: I opened a PR for just those changes as https://github.com/llvm/llvm-project/pull/74852 . For now, I hope it's OK if I leave them here too as I continue working on the bit-cast part: I'd still like to have them locally, and there's a lot of `git rebase -i` involved

[clang] [Clang][C++20] Implement constexpr std::bit_cast for bit-fields (& [Sema] Print more static_assert exprs) (PR #74775)

2023-12-08 Thread Timm Baeder via cfe-commits
tbaederr wrote: I don't have the capacity to review this properly, but the changes to the `static_assert` diagnostics should be split out IMO. https://github.com/llvm/llvm-project/pull/74775 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang][C++20] Implement constexpr std::bit_cast for bit-fields (& [Sema] Print more static_assert exprs) (PR #74775)

2023-12-08 Thread via cfe-commits
@@ -49,19 +48,33 @@ #include "clang/AST/OptionalDiagnostic.h" #include "clang/AST/RecordLayout.h" #include "clang/AST/StmtVisitor.h" +#include "clang/AST/Type.h" #include "clang/AST/TypeLoc.h" #include "clang/Basic/Builtins.h" -#include "clang/Basic/DiagnosticSema.h"

[clang] [Clang][C++20] Implement constexpr std::bit_cast for bit-fields (& [Sema] Print more static_assert exprs) (PR #74775)

2023-12-07 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: None (sethp) Changes After this commit, clang permits constructions like: ```c++ struct bits { unsigned char : 7; unsigned char flag : 1; } static_assert(std::bit_castbits(0x80).flag); // succeeds on little-endian systems ``` A

[clang] [Clang][C++20] Implement constexpr std::bit_cast for bit-fields (& [Sema] Print more static_assert exprs) (PR #74775)

2023-12-07 Thread via cfe-commits
https://github.com/sethp created https://github.com/llvm/llvm-project/pull/74775 After this commit, clang permits constructions like: ```c++ struct bits { unsigned char : 7; unsigned char flag : 1; } static_assert(std::bit_cast(0x80).flag); // succeeds on little-endian systems ``` A