-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"
Description
#include <bit>
#include <type_traits>
template <typename Derived, typename Type>
struct alignas(sizeof(Type)) bit_field
{
};
struct S : bit_field<S, int>
{
bool a : 1;
constexpr S() noexcept = default;
constexpr S(int i) noexcept: S( std::bit_cast<S>( i ) ) {}
};
static_assert(sizeof(S) == sizeof(int));
static_assert(std::is_trivially_copyable_v<S>);
static_assert(std::is_trivially_copyable_v<int>);
constexpr S sa = 0x00000001; // <source>(21)
https://godbolt.org/z/z99v39n1Y
bit_cast.h:31:12: note: constexpr bit_cast involving bit-field is not yet supported
return __builtin_bit_cast(_ToType, __from);
^
Well, because of the note, I think this is a known issue.
But I couldn't find it via github issues, so I decided to create a new one.
https://github.com/llvm/llvm-project/issues?q=__builtin_bit_cast+is%3Aopen
https://github.com/llvm/llvm-project/issues?q=bit_cast+is%3Aopen
JohelEGP, frederick-vs-ja and nico
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"