diff options
| author | 2014-05-31 19:04:35 +0200 | |
|---|---|---|
| committer | 2014-07-16 12:46:37 +0200 | |
| commit | cd1d5786d998efdf18e9938db957f82331bab579 (patch) | |
| tree | 91be49550af2d43d951954738405a04261ff4fb5 | |
| parent | BitField: Delete copy assignment to prevent obscure bugs. (diff) | |
| download | yuzu-cd1d5786d998efdf18e9938db957f82331bab579.tar.gz yuzu-cd1d5786d998efdf18e9938db957f82331bab579.tar.xz yuzu-cd1d5786d998efdf18e9938db957f82331bab579.zip | |
BitField: Add a static_assert.
Being able to store BitField within unions requires BitField to be of standard layout, which in turn is only given if the underlying type is also has standard layout.
| -rw-r--r-- | src/common/bit_field.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/common/bit_field.h b/src/common/bit_field.h index c28e722c8..52f0d8be6 100644 --- a/src/common/bit_field.h +++ b/src/common/bit_field.h | |||
| @@ -189,5 +189,6 @@ private: | |||
| 189 | static_assert(position < 8 * sizeof(T), "Invalid position"); | 189 | static_assert(position < 8 * sizeof(T), "Invalid position"); |
| 190 | static_assert(bits <= 8 * sizeof(T), "Invalid number of bits"); | 190 | static_assert(bits <= 8 * sizeof(T), "Invalid number of bits"); |
| 191 | static_assert(bits > 0, "Invalid number of bits"); | 191 | static_assert(bits > 0, "Invalid number of bits"); |
| 192 | static_assert(std::is_standard_layout<T>::value, "Invalid base type"); | ||
| 192 | }; | 193 | }; |
| 193 | #pragma pack() | 194 | #pragma pack() |