[Bug c++/65512] New: Inconsistent report of uninitialized members
development@faf-ltd.com
gcc-bugzilla@gcc.gnu.org
Sun Mar 22 13:49:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65512
Bug ID: 65512
Summary: Inconsistent report of uninitialized members
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: blocker
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: development@faf-ltd.com
#include <atomic>
typedef struct
{
char sDateTime [20];
std::atomic<bool> bReadyToFlush;
} LogEntries;
typedef struct
{
LogEntries leLogEntries [1] {};
} LogThreads;
Compiling with g++ -std=c++11 gcc-warning-bug.cpp -Wall -Wextra -Werror
-fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations -c
Compiler error:
gcc-warning-bug.cpp:11:34: error: missing initializer for member
‘LogEntries::sDateTime’ [-Werror=missing-field-initializers]
LogEntries leLogEntries [1] {};
^
gcc-warning-bug.cpp:11:34: error: missing initializer for member
‘LogEntries::bReadyToFlush’ [-Werror=missing-field-initializers]
cc1plus: all warnings being treated as error
I consider it as a bug because one of these following steps does not produce
the error message:
1) comment the line std::atomic<bool> bReadyToFlush;
2) Add {} to char sDateTime [20];
More information about the Gcc-bugs
mailing list