[llvm-bugs] [Bug 47018] New: Feature request: warn about unnecessary comparison to nullptr
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Aug 6 09:54:11 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47018
Bug ID: 47018
Summary: Feature request: warn about unnecessary comparison to
nullptr
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
Clang warns in some contexts about unnecessary comparisons to nullptr, like
----
int main(){
int i = 42;
&i != nullptr;
}
----
but it does not when comparing function references:
----
void foo(){}
int main(){
void(&f)() = foo;
return f != nullptr;
}
----
(compiled with "-Weverything -Wno-c++98-compat -Wno-missing-prototypes
-Wno-c++98-compat-pedantic")
https://godbolt.org/z/nEbcbM
For reference, GCC does emit a warning through the switch "-Waddress".
--
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/20200806/e77ea363/attachment.html>
More information about the llvm-bugs
mailing list