================
@@ -1277,19 +1278,27 @@ QualType 
Sema::CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI,
     TSI = SubstAutoTypeSourceInfoDependent(TSI);
   }
 
-  return CheckNonTypeTemplateParameterType(TSI->getType(), Loc);
+  return CheckNonTypeTemplateParameterType(TSI->getType(), Loc, Diagnose);
 }
 
-bool Sema::RequireStructuralType(QualType T, SourceLocation Loc) {
+bool Sema::RequireStructuralType(QualType T, SourceLocation Loc,
+                                 bool Diagnose) {
   if (T->isDependentType())
     return false;
 
-  if (RequireCompleteType(Loc, T, diag::err_template_nontype_parm_incomplete))
+  if (Diagnose ? RequireCompleteType(Loc, T,
+                                     
diag::err_template_nontype_parm_incomplete)
+               : !isCompleteType(Loc, T))
     return true;
 
   if (T->isStructuralType())
     return false;
 
+  // If we're not emitting diagnostics, there's no need to figure out
+  // why exactly T is not a structural type.
+  if (!Diagnose)
+    return true;
----------------
mizvekov wrote:

I think this is not exactly true.

Down below, we would RequireLiteralType, which in turn will 
RequireCompleteType, which has side effects.
It can perform instantiations, lock down the inheritance model under MSVC, and 
so on.

https://github.com/llvm/llvm-project/pull/132189
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to