This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/79307] g++ misses warning for reference on temporary that invokes undefined behaviour


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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]