This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/65168] New: diagnostic: missing: reference cannot be bound to dereferenced null pointer
- From: "jan.kratochvil at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 22 Feb 2015 18:30:53 +0000
- Subject: [Bug c++/65168] New: diagnostic: missing: reference cannot be bound to dereferenced null pointer
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65168
Bug ID: 65168
Summary: diagnostic: missing: reference cannot be bound to
dereferenced null pointer
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jan.kratochvil at redhat dot com
Target: x86_64-linux-gnu
int main() {
int *p=static_cast<int *>(0),&r=*p;
return !&r;
}
-Wall
g++ (GCC) 5.0.0 20150221 (experimental)
<nothing>
clang++ (clang-3.5.0-6.fc21.x86_64):
ref.C:3:12: warning: reference cannot be bound to dereferenced null pointer in
well-defined C++ code; pointer may be assumed to always convert to true
[-Wundefined-bool-conversion]
I have no idea if it can be miscompiled by either compiler. Still I find
useful to be notified I write non-conforming C++ code.