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

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 8 21:27:22 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.
----------------
zwuis wrote:

Unnecessary comment? We should issue "incompatible" diagnostic for all features.

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


More information about the cfe-commits mailing list