[clang] [C++20][Modules] Load function body from the module that gives canonical decl (PR #111992)

Dmitry Polukhin via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 5 10:04:46 PST 2024


================
@@ -1976,14 +1976,16 @@ TemplateDeclInstantiator::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
   if (!InstParams)
     return nullptr;
 
+  // Use canonical templated decl because only canonical decl has body
+  // if declarations were merged during loading from modules.
+  FunctionDecl *TemplatedDecl = D->getTemplatedDecl()->getCanonicalDecl();
----------------
dmpolukhin wrote:

Thank you for the good catch!

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


More information about the cfe-commits mailing list