This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH c++] Reduce -Weffc++ Rule 12 false positives
On Tuesday, 7. February 2006 23:25, Gabriel Dos Reis wrote:
> but, that it not what your code implements. It implements something
> different if I read your patch correctly.
>
> +struct B
> +{
> + B() {}
> +
> + int bogus; // { dg-bogus "should be initialized in the member" }
> + nontriv right; // { dg-warning "should be initialized in the member"
> } +};
>
> We should be warning to the effect that B::bogus is not initialized.
Ah, thats what you worry about. Ok, modify the testcase:
struct B
{
B() { bogus = 42; }
int bogus; // { dg-bogus "should be initialized in the member" }
nontriv right; // { dg-warning "should be initialized in the member"
};
What you refer to might make *sense* (even though partially constructed
classes are still okay in optimized code) though, but thats not what the
-Weffc++ warning implemented (neither before nor now, and not even intended).
Dirk