This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/85691] New: Faulty Class Member Default Initialization - No Warning or Error
- From: "roger at rankedgaming dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 08 May 2018 01:08:44 +0000
- Subject: [Bug c++/85691] New: Faulty Class Member Default Initialization - No Warning or Error
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85691
Bug ID: 85691
Summary: Faulty Class Member Default Initialization - No
Warning or Error
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: roger at rankedgaming dot com
Target Milestone: ---
/// Bug Report
struct test
{
int x = data;
int data;
test(int o) : data(o) { }
};
/// Potentially Related Issue
struct test2
{
int x;
int data;
test2(int o) : data(o), x(data) { }
};
/*
- Details -
There should be a warning/error for test and test2.
In test the default initialization of x relies on data, which is initialized
after x.
In test2 the constructor initialization list is out of order. Same result as
for test.
- Note -
clang displays a warning for both these cases, but neither gcc nor msvc do
*/