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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue May 3 05:33:23 PDT 2016


aaron.ballman added a subscriber: aaron.ballman.

================
Comment at: lib/Sema/SemaInit.cpp:3513
@@ -3512,1 +3512,3 @@
 
+static void CheckForNullPointerDereference(Sema &S, Expr *E) {
+  // Check to see if we are dereferencing a null pointer.  If so,
----------------
Can this take a `const Expr *` instead?

================
Comment at: lib/Sema/SemaInit.cpp:3649
@@ -3631,1 +3648,3 @@
 
+  for (Expr *Arg : Args) {
+    CheckForNullPointerDereference(S, Arg);
----------------
`const Expr *` (or `const auto *`) instead?

================
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}}
 }
----------------
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).


http://reviews.llvm.org/D19851





More information about the cfe-commits mailing list