[PATCH] D19851: Warn on binding reference to null in copy initialization

Nick Lewycky via cfe-commits cfe-commits at lists.llvm.org
Wed May 4 00:16:07 PDT 2016


nicholas marked 2 inline comments as done.
nicholas added a comment.

Richard Smith gave me some review feedback in person, the diagnostic should not be generated when setting up the Steps for the initializer sequence, but instead when InitializerSequence::Perform is called. This appears to work correctly and also catches a few more cases.

I did not expand this to SK_BindReferenceToTemporary, please review this decision. It's also missing missing bit-field and vector element checks that SK_BindReference has.

Also, I'd appreciate comments on the factoring with CheckForNullPointerDereference which was copied+pasted from SemaExpr.cpp. Please review this issue too, I did not expect to land the patch the way it's currently written.


================
Comment at: test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp:39
@@ -38,3 +38,3 @@
 
-  bogus_override_if_virtual<decltype(l)> bogus;
+  bogus_override_if_virtual<decltype(l)> bogus; // expected-note{{in instantiation of member function 'bogus_override_if_virtual<(lambda}}
 }
----------------
aaron.ballman wrote:
> Missing `>` in the diagnostic text (I know it's not required, but it looks a bit strange if that's the only part missing from the diagnostic text).
What follows lambda is the path to the file, then the closing )>. I'd rather not include that part. I could make it up with .* just to balance the parens, but I think that's not worth it.


http://reviews.llvm.org/D19851





More information about the cfe-commits mailing list