[clang] [Clang] Skip function template bodies that have no dependent context (PR #226805)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 28 12:46:24 PDT 2026


================
@@ -138,6 +138,16 @@ NamedDecl *Parser::ParseCXXInlineMethodDef(
     return FnD;
   }
 
+  // The template parameters are in scope but there is no dependent context.
+  if (auto *FD = dyn_cast_if_present<FunctionDecl>(FnD);
+      FD && TemplateInfo.Kind == ParsedTemplateKind::Template &&
+      FD->isInvalidDecl() && !FD->isDependentContext()) {
+    CachedTokens Toks;
+    LexTemplateFunctionForLateParsing(Toks);
+    Actions.ActOnSkippedFunctionBody(FnD);
+    return FnD;
----------------
ojhunt wrote:

This doesn't appear to be OMP specific, are you sure that this is correct? It _feels_ like this is trying to essentially special case the test case?

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


More information about the cfe-commits mailing list