[Bug c++/67445] New: New warning: returning std::initializer_list bound to temporary
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Sep 3 21:57:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67445
Bug ID: 67445
Summary: New warning: returning std::initializer_list bound to
temporary
Product: gcc
Version: 4.9.4
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
It would be useful if -Wreturn-local-addr warned for the following:
std::initializer_list<int> f() {
return { 1, 2, 3};
}
This creates a temporary array, then returns a std::initializer_list containing
a dangling pointer.
More information about the Gcc-bugs
mailing list