[Bug c++/79307] g++ misses warning for reference on temporary that invokes undefined behaviour
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jan 31 18:36:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79307
--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
If I remove the first one, I do get a warning
x.c: In function 'int main()':
x.c:5:47: warning: '<anonymous>' is used uninitialized in this function
[-Wuninitialized]
void DoSomething() { cout << "int:" << a_ << endl; }
^~
x.c:13:22: note: '<anonymous>' was declared here
TestRefInt ltfi(8);
^
what prevents the warning otherwise:
- several calls -> not inlined
- static initializers are opaque to gcc's optimizers (even with LTO)
More information about the Gcc-bugs
mailing list