Experienced with 4.1.1, 4.1.2 and 4.2.1. Below is the minimum test case that I
can narrow it down to while being reproducible across these versions.
$ g++ -O3 -Wall test.cpp -o test
test.cpp: In function int main():
test.cpp:19: warning: this.11 is used uninitialized in this function
test.cpp:19: note: this.11 was declared here
ws004:/tmp$
---
struct base1
{
int function() { return 1; }
};
struct base2 : public base1
{
double val1;
double val2;
};
struct myclass : public base2
{
public:
int x;
myclass()
{
x = this->function();
}
};
static myclass init_instance()
{
return myclass();
}
struct test_harness
{
const myclass instance;
test_harness() : instance(init_instance())
{
}
int result()
{
return instance.x;
}
};
int main(void)
{
test_harness x;
return x.result();
}
--
Summary: Warning: `this.11' is used uninitialized in this
function
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: matthewc at cse dot unsw dot edu dot au
GCC build triplet: i686-pc-linux
GCC host triplet: i686-pc-linux
GCC target triplet: i686-pc-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33665