Skip to content

Commit b81d8e9

Browse files
jsjiSirraidecor3ntin
authored
[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 <[email protected]> Co-authored-by: cor3ntin <[email protected]>
1 parent d6e714b commit b81d8e9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

clang/lib/Parse/ParseDeclCXX.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3148,11 +3148,13 @@ Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclaration(
31483148
// we did nothing here, but this allows us to issue a more
31493149
// helpful diagnostic.
31503150
if (Tok.is(tok::kw_concept)) {
3151-
Diag(Tok.getLocation(),
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);
3151+
Diag(
3152+
Tok.getLocation(),
3153+
DS.isFriendSpecified() || NextToken().is(tok::kw_friend)
3154+
? llvm::to_underlying(diag::err_friend_concept)
3155+
: llvm::to_underlying(
3156+
diag::
3157+
err_concept_decls_may_only_appear_in_global_namespace_scope));
31563158
SkipUntil(tok::semi, tok::r_brace, StopBeforeMatch);
31573159
return nullptr;
31583160
}

0 commit comments

Comments
 (0)