https://bugs.llvm.org/show_bug.cgi?id=46913
Bug ID: 46913
Summary: -Wuninitialized inside lambda
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: federico.kirch...@gmail.com
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk
I've a bug that GCC was able to avoid thanks to "-Wuninitialized -O1", but that
clang fails to diagnose.
The reduced test-case is
----
int main() {
int i = [&](){return i;}();
return i;
}
----
I've tried compiling with "-Weverything -Wno-c++98-compat -O2" and other
optimizations level, without any luck.
Notice that
----
int main() {
int i = i;
return i;
}
----
gets diagnosed correctly with "warning: variable 'i' is uninitialized when used
within its own initialization [-Wuninitialized]".
Another example where clang does not emit any diagnostic but GCC does:
----
int main() {
int i;
[&](){i++;}();
return i;
}
----
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs