[Bug c++/81674] New: gcc cannot detect missing initialisers for fields in constructors
dcb314 at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Aug 2 14:36:00 GMT 2017
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.
More information about the Gcc-bugs
mailing list