This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/79307] g++ misses warning for reference on temporary that invokes undefined behaviour
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 31 Jan 2017 18:36:27 +0000
- Subject: [Bug c++/79307] g++ misses warning for reference on temporary that invokes undefined behaviour
- Auto-submitted: auto-generated
- References: <bug-79307-4@http.gcc.gnu.org/bugzilla/>
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)