[clang] No longer add enumeration constants to the wrong scope (PR #134998)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 9 12:24:59 PDT 2025


================
@@ -5585,6 +5585,18 @@ SourceRange EnumConstantDecl::getSourceRange() const {
   return SourceRange(getLocation(), End);
 }
 
+bool EnumConstantDecl::isOutOfLine() const {
+  if (Decl::isOutOfLine())
+    return true;
+
+  // In C++, if the enumeration is out of line, the enumeration constants are
+  // also out of line.
+  if (getLangOpts().CPlusPlus)
----------------
erichkeane wrote:

I can kinda see both ways here actually... there is a seemingly equal risk of "C won't standardize something enough like C++" and "C will standardize what C++ does".  And the part I'd be concerned about is, "Implementer didn't realize the implications of everything, so accidentally partially implemented"

In each case we get similar bug reports, though inverted based on case.  I could go either way.

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


More information about the cfe-commits mailing list