[clang] [Clang] Reapply CWG2369 "Ordering between constraints and substitution" (PR #122423)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 11 11:42:47 PST 2025


================
@@ -5284,8 +5284,22 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
     savedContext.pop();
   }
 
-  DeclGroupRef DG(Function);
-  Consumer.HandleTopLevelDecl(DG);
+  // With CWG2369, we substitute constraints before instantiating the associated
+  // function template. This helps prevent potential code generation for
+  // dependent types, particularly under the MS ABI.
----------------
cor3ntin wrote:

```suggestion
  // We never need to emit the code for a lambda in unevaluated context.
  // We also can't mangle a lambda in the require clause of a function template 
  // during constraint checking as the MSI ABI would need to mangle the (not yet specialized) enclosing declaration
  // FIXME: Should we try to skip this for non-lambda functions too?
```

https://github.com/llvm/llvm-project/pull/122423


More information about the cfe-commits mailing list