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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected]
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._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs