[Bug c++/82900] New: Warn on initialization with self
antoshkka at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Nov 8 13:43:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82900
Bug ID: 82900
Summary: Warn on initialization with self
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: antoshkka at gmail dot com
Target Milestone: ---
Following code
struct Y { Y(Y&){} };
int main() {
Y y(y);
}
Produces a useful warning on clang:
warning: variable 'y' is uninitialized when used within its own initialization
[-Wuninitialized]
Y y(y);
~ ^
It would be nice to have this warning in GCC, especially because this case may
produce unexpected results after implementing Bug 82899
More information about the Gcc-bugs
mailing list