[clang] b81d8e9 - [NFC][Clang] Fix enumerated mismatch warning (#112816)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 22 06:35:45 PDT 2024
Author: Jinsong Ji
Date: 2024-10-22T09:35:41-04:00
New Revision: b81d8e90339a788cc6cb148831612c6b39b93ad5
URL: https://github.com/llvm/llvm-project/commit/b81d8e90339a788cc6cb148831612c6b39b93ad5
DIFF: https://github.com/llvm/llvm-project/commit/b81d8e90339a788cc6cb148831612c6b39b93ad5.diff
LOG: [NFC][Clang] Fix enumerated mismatch warning (#112816)
This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on.
Built by GCC 11.
```
Fix warning:
llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3153:14: error: enumerated mismatch in conditional expression: ‘clang::diag::<unnamed enum>’ vs ‘clang::diag::<unnamed enum>’ [-Werror=enum-compare]
3152 | DS.isFriendSpecified() || NextToken().is(tok::kw_friend)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3153 | ? diag::err_friend_concept
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
3154 | : diag::
| ~~~~~~~~
3155 | err_concept_decls_may_only_appear_in_global_namespace_scope);
```
---------
Co-authored-by: Sirraide <aeternalmail at gmail.com>
Co-authored-by: cor3ntin <corentinjabot at gmail.com>
Added:
Modified:
clang/lib/Parse/ParseDeclCXX.cpp
Removed:
################################################################################
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index 6f0f5a0311bc18..b28c2a9db91b0f 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -3148,11 +3148,13 @@ Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclaration(
// we did nothing here, but this allows us to issue a more
// helpful diagnostic.
if (Tok.is(tok::kw_concept)) {
- Diag(Tok.getLocation(),
- DS.isFriendSpecified() || NextToken().is(tok::kw_friend)
- ? diag::err_friend_concept
- : diag::
- err_concept_decls_may_only_appear_in_global_namespace_scope);
+ Diag(
+ Tok.getLocation(),
+ DS.isFriendSpecified() || NextToken().is(tok::kw_friend)
+ ? llvm::to_underlying(diag::err_friend_concept)
+ : llvm::to_underlying(
+ diag::
+ err_concept_decls_may_only_appear_in_global_namespace_scope));
SkipUntil(tok::semi, tok::r_brace, StopBeforeMatch);
return nullptr;
}
More information about the cfe-commits
mailing list