This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81674] New: gcc cannot detect missing initialisers for fields in constructors
- From: "dcb314 at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 02 Aug 2017 14:36:36 +0000
- Subject: [Bug c++/81674] New: gcc cannot detect missing initialisers for fields in constructors
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81674
Bug ID: 81674
Summary: gcc cannot detect missing initialisers for fields in
constructors
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Target Milestone: ---
Given the following C++ source code:
struct S
{
int a, b, c;
S() : a( 0)
{
b = 1;
};
};
then I cannot get gcc to detect the missing initialiser for field c.
$ ~/gcc/results/bin/gcc -c -O2 -Wall -Wextra aug2a.cc
$
Here is static analyser cppcheck finding the problem:
$ ~/cppcheck/trunk/cppcheck --enable=all aug2a.cc
[aug2a.cc:8]: (warning) Member variable 'S::c' is not initialized in the
constructor.
$
cppcheck can find 55 examples of this problem in the gcc source code alone,
so it would appear to be of some value to gcc, to say nothing of customers
of gcc.