pcc added inline comments.
================ Comment at: clang/lib/Sema/SemaType.cpp:2451-2455 + // FIXME: This will cause errors if template instantiation fails. + if (!Context.getDiagnostics().isIgnored(diag::warn_memptr_incomplete, Loc) && + !Class->isDependentType() && + !Class->getAsCXXRecordDecl()->isBeingDefined()) + RequireCompleteType(Loc, Class, diag::warn_memptr_incomplete); ---------------- rsmith wrote: > This doesn't seem right. Calling `RequireCompleteType` will trigger > instantiation of the type if it's templated, which can affect the validity > (and rarely, the meaning) of the program. Also, passing a warning diagnostic > into `RequireCompleteType` doesn't actually work -- there are cases where it > will disregard your diagnostic and substitute one of its own, which will be > an error. You're right, but I couldn't see a way of testing whether a type is complete without triggering those side effects. It does look like we can at least avoid some of them with `isCompleteType`, though. I guess the best we can do is to move the diagnostic into `RequireCompleteTypeImpl` and make it conditional on `isCompleteType` as @rnk suggested. https://reviews.llvm.org/D47503 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits