[clang] [C2y] Allow static local variables in inline functions with external … (PR #167086)

Pranjal Prajapati via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 8 21:34:20 PST 2025


================
@@ -8111,6 +8111,11 @@ NamedDecl *Sema::ActOnVariableDeclarator(
   //   An inline definition of a function with external linkage shall
   //   not contain a definition of a modifiable object with static or
   //   thread storage duration...
+  //
+  // WG14 N3622 which removed the constraint entirely in C2y. It is left
+  // enabled in earlier language modes because this is a constraint in those
+  // language modes. But in C2y mode, we still want to issue the "incompatible
+  // with previous standards" diagnostic, too.
----------------
Pranjal095 wrote:

I do see your point. However, I wanted to ensure it was as consistent as possible with the linked commit.

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


More information about the cfe-commits mailing list