rsmith added inline comments.

================
Comment at: clang/lib/Sema/SemaType.cpp:7599-7604
+      if (!Context.getDiagnostics().isIgnored(diag::warn_memptr_incomplete,
+                                              Loc) &&
+          !MPTy->getClass()->getAsCXXRecordDecl()->isBeingDefined() &&
+          !isCompleteType(Loc, QualType(MPTy->getClass(), 0)))
+        Diag(Loc, diag::warn_memptr_incomplete)
+            << QualType(MPTy->getClass(), 0);
----------------
It's not reasonable to call `isCompleteType` here; this is non-conforming 
behavior, and it's not reasonable for a warning flag to change the semantics or 
interpretation of the program. (We actually rely on this in several ways -- 
`-Weverything` is not supposed to change the validity of programs, and reuse of 
implicit modules with different warning flags relies on the property that the 
compiler behavior is as if we compile with `-Weverything` and then filter the 
warnings after the fact.)

It seems fine to do this in the MS ABI case, since we will attempt to complete 
the type anyway in that mode. If you want to apply this more generally, I think 
there are two options: either add a `-f` flag to carry this semantic change, or 
figure out whether the type is completable without actually completing it (for 
example, check whether it's a templated class whose pattern is a definition).


https://reviews.llvm.org/D47503



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to