Warning for uninitialized variable in chained constructor [message #1767389] |
Wed, 05 July 2017 09:55  |
Eclipse User |
|
|
|
I have a template class with a chained constructor. The child constructor get a CDT warning that it does not initialize all of the variables even though they are initialized in the parent constructor. I have tried putting the comment @suppress("Class members should be properly initialized") pretty much everywhere I can think of to get it to work, but it never seems to be recognized. Trying to make sure I am not doing something wrong before posting tickets to bugzilla.
example code:
GenericDescriptor(PsiReader &psiReader, bool shouldReadFullDescriptor = true)
{
... // initializes variables and sets up class.
}
GenericDescriptor(PsiReader &psiReader,
T expectedType)
:GenericDescriptor(psiReader, false)
{
... //performs additional checks and set up
}
To me it seems like there are two things wrong here. First adding the @suppress comment after the line with the constructor should cause the warning to be suppressed and second the warning should never be generated since the variables are being initialized in the chained constructor.
for the record looks like the @suppress comment tag was added via https://bugs.eclipse.org/bugs/show_bug.cgi?id=383576
[Updated on: Wed, 05 July 2017 09:59] by Moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03611 seconds