aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-11-13 14:13:09 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-11-13 14:13:09 +0200
commit2933e1a01a6f49b60b4b9a2c7bd1439cbadc982a (patch)
treee4d877c60fd63866ea21a8078eb97626e871d1b2
parentd9af320fbdfdadd70815d4f14a9116829dfabdf0 (diff)
Fix bizarre "maybe used uninitialized" GCC warnings in optional usage
The warning was only issued in certain cases when sizeof(T) was 1 byte (bool, uint8_t).
-rw-r--r--libbutl/optional.mxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/libbutl/optional.mxx b/libbutl/optional.mxx
index e7e00dd..0f18c11 100644
--- a/libbutl/optional.mxx
+++ b/libbutl/optional.mxx
@@ -43,7 +43,7 @@ LIBBUTL_MODEXPORT namespace butl
template <typename T>
struct optional_data<T, false>
{
- struct empty {};
+ struct empty {char x;}; // Note: byte size is important to GCC.
union
{
@@ -86,7 +86,7 @@ LIBBUTL_MODEXPORT namespace butl
template <typename T>
struct optional_data<T, true>
{
- struct empty {};
+ struct empty {char x;}; // Note: byte size is important to GCC.
union
{