[PATCH] MismatchingNewDeleteDetector uses incorrect field, and finds no initializer

Richard Smith richard at metafoo.co.uk
Wed May 20 15:58:52 PDT 2015


================
Comment at: lib/Sema/SemaExprCXX.cpp:2494
@@ +2493,3 @@
+    TemplateSpecializationKind TSK = ParentRD->getTemplateSpecializationKind();
+    if (isTemplateInstantiation(TSK)) {
+      CXXRecordDecl *ClassPattern = ParentRD->getTemplateInstantiationPattern();
----------------
You'll still crash if this check fails. You could assert this condition instead, but `InitExpr` could still be null even then, in principle (if we're somehow getting called while still parsing the definition of the class).

The in-class initializer is not relevant if no constructor actually uses it. Instead of this change, you could just return `EndOfTU ? NoMismatch : AnalyzeLater` if `InitExpr` is null.

http://reviews.llvm.org/D9898

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list