[Bug c++/11554] New: Warning about reordering of initializers doesn't mention location of constructor
bangerth at dealii dot org
gcc-bugzilla@gcc.gnu.org
Wed Jul 16 23:32:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11554
Summary: Warning about reordering of initializers doesn't mention
location of constructor
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bangerth at dealii dot org
CC: gcc-bugs at gcc dot gnu dot org,gdr at gcc dot gnu dot
org
When one accidentally orders initializers of member variables in another
order than the one they appear in the class declaration, one gets a
warning about this. However, this warning doesn't state where the
problem is:
------------------------------------
struct Y {
Y ();
int i1, i2;
};
Y::Y () : i2(0), i1(0) {}
------------------------------------
parameter-estimation/me-uncertainty> c++ -Wall -c x.cc
x.cc: In constructor `Y::Y()':
x.cc:3: warning: `Y::i2' will be initialized after
x.cc:3: warning: `int Y::i1'
So this gives the location where i1 and i2 are _declared_, but it doesn't
show where the problem really is, namely in the _definition_ of the
constructor, or more exactly: in its member initializer list, which would
be in line 6. This can become a little confusing if one has a class with
more than one constructor.
W.
More information about the Gcc-bugs
mailing list