| Summary: | False positive warnings about members not initialized in constructor | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Axel Mueller <aegges> |
| Component: | cdt-codan | Assignee: | Marc-André Laperle <malaperle> |
| Status: | RESOLVED FIXED | QA Contact: | Elena Laskavaia <elaskavaia.cdt> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug, malaperle |
| Version: | 8.1.0 | ||
| Target Milestone: | 8.1.0 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Axel Mueller
Hi Axel, I tried this and couldn't reproduce the false positive:
---test.h---
#ifndef TEST_H_
#define TEST_H_
class C {
public:
int field;
C();
};
#endif
---test.cpp---
#include "test.h"
void initObject(C* c);
C::C() {
initObject(this);
}
Does that work for you?
(In reply to comment #1) > Hi Axel, I tried this and couldn't reproduce the false positive: That was using master b939129f (8.1) which is about a week old. Ah I see now a fp now if I put initObject inside the class to make it a method. Was that the fp you encountered? > Ah I see now a fp now if I put initObject inside the class to make it a method. > Was that the fp you encountered? I was using the code you mentioned in comment #1. I used a nightly build from January to test it. You might have found another fp. *** cdt git genie on behalf of Marc-Andre Laperle ***
Bug 368419 - FP in members not initialized in constructor
[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=0a9a95adcd3ba273c1b67a11483d19d435f2b2f2
(In reply to comment #4) > > Ah I see now a fp now if I put initObject inside the class to make it a method. > > Was that the fp you encountered? > I was using the code you mentioned in comment #1. I used a nightly build from > January to test it. You might have found another fp. I fixed the fp when the non-const method is used but I still can't reproduce the fp when a function is used. Sorry to ask but can you try again with a recent nightly build? I must be missing something... or maybe you really did have initObject as a method. (In reply to comment #6) > I fixed the fp when the non-const method is used but I still can't reproduce > the fp when a function is used. Sorry to ask but can you try again with a > recent nightly build? I must be missing something... or maybe you really did > have initObject as a method. I think you are right. I had initObject() as a method. That is the usual way I implement a class. So I can reset the object anytime I want by calling initObject(). You can close the bug then. OK, thanks Axel! |