[clang] [Clang][Sema] Diagnose friend declarations with enum elaborated-type-specifier in all language modes (PR #80171)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 7 09:57:45 PST 2024


================
@@ -2552,10 +2552,10 @@ class Parser : public CodeCompletionHandler {
   /// Starting with a scope specifier, identifier, or
   /// template-id that refers to the current class, determine whether
   /// this is a constructor declarator.
-  bool isConstructorDeclarator(
-      bool Unqualified, bool DeductionGuide = false,
-      DeclSpec::FriendSpecified IsFriend = DeclSpec::FriendSpecified::No,
-      const ParsedTemplateInfo *TemplateInfo = nullptr);
+  bool
+  isConstructorDeclarator(bool Unqualified, bool DeductionGuide = false,
+                          bool IsFriend = false,
----------------
sdkrystian wrote:

@erichkeane The rationale behind removing `DeclSpec::FriendSpecified`:
- Writing `DeclSpec::FriendSpecified::Yes/No` is unnecessarily verbose.
- It isn't scalable when `FriendSpecified` is an unscoped enumeration type (enumerators would conflict). On the other hand, using a scoped enumeration type precludes implicit conversions to `bool`.
- `isConstructorDeclarator` is the only place where it's used, and the existing convention is to use `bool` parameters.

Nevertheless, I added a commit which reverts the change.

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


More information about the cfe-commits mailing list