[cfe-commits] r145575 - in /cfe/trunk: lib/StaticAnalyzer/Core/ExprEngine.cpp test/Analysis/misc-ps-region-store.cpp
richard at metafoo.co.uk
Sun Dec 11 13:53:39 CST 2011
On Sun, December 11, 2011 08:15, Jonathan Sauer wrote:
>> Hi, Ted. Just wanted to note that it's technically legal for 'this' to be
>> null if the method is non-virtual, which I'm sure you know already. Maybe
>> someday we can make this a setting?
> I'm not so sure about that. After all, when calling the method as in
> "obj->method()", you dereference the pointer. And
> dereferencing a NULL pointer results in undefined behaviour.
That is a controversial position. My understanding is that the intent of the
committee is that dereferencing a null pointer is not undefined behaviour; an
lvalue-to-rvalue conversion on the result is, as is binding a reference to
such a value.
> C.f. this thread:
The relevant quotation there seems to be from [class.memfct.non-static]p1. The
standard only provides permission to call member functions only on pointers to
an object of the relevant type (or a type derived from it).
More information about the cfe-commits