[llvm-bugs] [Bug 46913] New: -Wuninitialized inside lambda
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jul 30 09:52:19 PDT 2020
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: unassignedclangbugs at nondot.org
Reporter: federico.kircheis at gmail.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200730/bc0944f1/attachment.html>
More information about the llvm-bugs
mailing list