WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
289669
[MagicEnum C++] EnumTraits.h:267:9: error: no matching function for call to 'enumName' with clang-20
https://bugs.webkit.org/show_bug.cgi?id=289669
Summary
[MagicEnum C++] EnumTraits.h:267:9: error: no matching function for call to '...
katoshi1337
Reported
2025-03-12 23:00:44 PDT
Hi, I noticed that the current master doesn't seem to be able to compile correctly. Did I miss something during compilation? Command: Tools/Scripts/build-webkit --jsc-only --release Logs: ``` FAILED: Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/EnumTraits.cpp.o /build/bin/clang++ -DBUILDING_JSCONLY__ -DBUILDING_TestWTF -DBUILDING_WEBKIT=1 -DBUILDING_WITH_CMAKE=1 -DGTEST_CREATE_SHARED_LIBRARY=1 -DGTEST_HAS_PTHREAD=1 -DGTEST_HAS_RTTI=0 -DHAVE_CONFIG_H=1 -DPAS_BMALLOC=1 -DSTATICALLY_LINKED_WITH_WTF -DSTATICALLY_LINKED_WITH_bmalloc -D_GLIBCXX_ASSERTIONS=1 -I/home/test/WebKitBuild/JSCOnly/Release -I/home/test/Tools/TestWebKitAPI -I/home/test/Source/ThirdParty/gtest/include -I/home/test/WebKitBuild/JSCOnly/Release/WTF/Headers -I/home/test/WebKitBuild/JSCOnly/Release/bmalloc/Headers -fdiagnostics-color=always -fcolor-diagnostics -Wextra -Wall -Werror=undefined-internal -Werror=undefined-inline -pipe -Wno-noexcept-type -Wno-psabi -Wno-misleading-indentation -Wno-parentheses-equality -Qunused-arguments -Wundef -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align -Wno-tautological-compare -fasynchronous-unwind-tables -fdebug-types-section -fno-strict-aliasing -fno-exceptions -fno-rtti -fcoroutines -ffunction-sections -fdata-sections -O3 -DNDEBUG -fPIE -fvisibility=hidden -fvisibility-inlines-hidden -Werror -Wno-dangling-else -Wno-sign-compare -Wno-undef -Wno-unused-parameter -std=c++2b -MD -MT Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/EnumTraits.cpp.o -MF Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/EnumTraits.cpp.o.d -o Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/EnumTraits.cpp.o -c /home/test/Tools/TestWebKitAPI/Tests/WTF/EnumTraits.cpp In file included from /home/test/Tools/TestWebKitAPI/Tests/WTF/EnumTraits.cpp:29: /home/test/WebKitBuild/JSCOnly/Release/WTF/Headers/wtf/EnumTraits.h:267:9: error: no matching function for call to 'enumName' 267 | enumName<static_cast<E>(static_cast<std::underlying_type_t<E>>(Is) + min)>()... | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/test/WebKitBuild/JSCOnly/Release/WTF/Headers/wtf/EnumTraits.h:275:12: note: in instantiation of function template specialization 'WTF::makeEnumNames<TestWebKitAPI::NonClassMultiWord, 0UL, 1UL, 2UL, 3UL, 4UL, 5UL, 6UL, 7UL, 8UL, 9UL, 10UL, 11UL, 12UL, 13UL, 14UL, 15UL, 16UL, 17UL, 18UL, 19UL, 20UL, 21UL, 22UL, 23UL, 24UL, 25UL, 26UL, 27UL, 28UL, 29UL, 30UL, 31UL, 32UL, 33UL, 34UL, 35UL, 36UL, 37UL, 38UL, 39UL, 40UL, 41UL, 42UL, 43UL, 44UL, 45UL, 46UL, 47UL, 48UL, 49UL, 50UL, 51UL, 52UL, 53UL, 54UL, 55UL, 56UL, 57UL, 58UL, 59UL, 60UL, 61UL, 62UL, 63UL, 64UL, 65UL, 66UL, 67UL, 68UL, 69UL, 70UL, 71UL, 72UL, 73UL, 74UL, 75UL, 76UL, 77UL, 78UL, 79UL, 80UL, 81UL, 82UL, 83UL, 84UL, 85UL, 86UL, 87UL, 88UL, 89UL, 90UL, 91UL, 92UL, 93UL, 94UL, 95UL, 96UL, 97UL, 98UL, 99UL, 100UL, 101UL, 102UL, 103UL, 104UL, 105UL, 106UL, 107UL, 108UL, 109UL, 110UL, 111UL, 112UL, 113UL, 114UL, 115UL, 116UL, 117UL, 118UL, 119UL, 120UL, 121UL, 122UL, 123UL, 124UL, 125UL, 126UL, 127UL, 128UL, 129UL, 130UL, 131UL, 132UL, 133UL, 134UL, 135UL, 136UL, 137UL, 138UL, 139UL, 140UL, 141UL, 142UL, 143UL, 144UL, 145UL, 146UL, 147UL, 148UL, 149UL, 150UL, 151UL, 152UL, 153UL, 154UL, 155UL, 156UL, 157UL, 158UL, 159UL, 160UL, 161UL, 162UL, 163UL, 164UL, 165UL, 166UL, 167UL, 168UL, 169UL, 170UL, 171UL, 172UL, 173UL, 174UL, 175UL, 176UL, 177UL, 178UL, 179UL, 180UL, 181UL, 182UL, 183UL, 184UL, 185UL, 186UL, 187UL, 188UL, 189UL, 190UL, 191UL, 192UL, 193UL, 194UL, 195UL, 196UL, 197UL, 198UL, 199UL, 200UL, 201UL, 202UL, 203UL, 204UL, 205UL, 206UL, 207UL, 208UL, 209UL, 210UL, 211UL, 212UL, 213UL, 214UL, 215UL, 216UL, 217UL, 218UL, 219UL, 220UL, 221UL, 222UL, 223UL, 224UL, 225UL, 226UL, 227UL, 228UL, 229UL, 230UL, 231UL, 232UL, 233UL, 234UL, 235UL, 236UL, 237UL, 238UL, 239UL, 240UL, 241UL, 242UL, 243UL, 244UL, 245UL, 246UL, 247UL, 248UL, 249UL, 250UL, 251UL, 252UL, 253UL, 254UL, 255UL, 256UL, 257UL, 258UL, 259UL, 260UL, 261UL, 262UL, 263UL, 264UL, 265UL, 266UL, 267UL, 268UL, 269UL, 270UL, 271UL, 272UL, 273UL, 274UL, 275UL, 276UL, 277UL, 278UL, 279UL, 280UL, 281UL, 282UL, 283UL, 284UL, 285UL, 286UL, 287UL, 288UL, 289UL, 290UL, 291UL, 292UL, 293UL, 294UL, 295UL, 296UL, 297UL, 298UL, 299UL, 300UL, 301UL, 302UL, 303UL, 304UL, 305UL, 306UL, 307UL, 308UL, 309UL, 310UL, 311UL, 312UL, 313UL, 314UL, 315UL, 316UL, 317UL, 318UL, 319UL, 320UL, 321UL, 322UL, 323UL, 324UL, 325UL, 326UL, 327UL, 328UL, 329UL, 330UL, 331UL, 332UL, 333UL, 334UL, 335UL, 336UL, 337UL, 338UL, 339UL, 340UL, 341UL, 342UL, 343UL, 344UL, 345UL, 346UL, 347UL, 348UL, 349UL, 350UL, 351UL, 352UL, 353UL, 354UL, 355UL, 356UL, 357UL, 358UL, 359UL, 360UL, 361UL, 362UL, 363UL, 364UL, 365UL, 366UL, 367UL, 368UL, 369UL, 370UL, 371UL, 372UL, 373UL, 374UL, 375UL, 376UL, 377UL, 378UL, 379UL, 380UL, 381UL, 382UL, 383UL, 384UL, 385UL, 386UL, 387UL, 388UL, 389UL, 390UL, 391UL, 392UL, 393UL, 394UL, 395UL, 396UL, 397UL, 398UL, 399UL, 400UL, 401UL, 402UL, 403UL, 404UL, 405UL, 406UL, 407UL, 408UL, 409UL, 410UL, 411UL, 412UL, 413UL, 414UL, 415UL, 416UL, 417UL, 418UL, 419UL, 420UL, 421UL, 422UL, 423UL, 424UL, 425UL, 426UL, 427UL, 428UL, 429UL, 430UL, 431UL, 432UL, 433UL, 434UL, 435UL, 436UL, 437UL, 438UL, 439UL, 440UL, 441UL, 442UL, 443UL, 444UL, 445UL, 446UL, 447UL, 448UL, 449UL, 450UL, 451UL, 452UL, 453UL, 454UL, 455UL, 456UL, 457UL, 458UL, 459UL, 460UL, 461UL, 462UL, 463UL, 464UL, 465UL, 466UL, 467UL, 468UL, 469UL, 470UL, 471UL, 472UL, 473UL, 474UL, 475UL, 476UL, 477UL, 478UL, 479UL, 480UL, 481UL, 482UL, 483UL, 484UL, 485UL, 486UL, 487UL, 488UL, 489UL, 490UL, 491UL, 492UL, 493UL, 494UL, 495UL, 496UL, 497UL, 498UL, 499UL, 500UL, 501UL, 502UL, 503UL, 504UL, 505UL, 506UL, 507UL, 508UL, 509UL, 510UL>' requested here 275 | return makeEnumNames<E>(std::make_index_sequence<size> { }); | ^ /home/test/WebKitBuild/JSCOnly/Release/WTF/Headers/wtf/EnumTraits.h:286:28: note: in instantiation of function template specialization 'WTF::enumNames<TestWebKitAPI::NonClassMultiWord>' requested here 286 | constexpr auto names = enumNames<E>(); | ^ /home/test/Tools/TestWebKitAPI/Tests/WTF/EnumTraits.cpp:201:50: note: in instantiation of function template specialization 'WTF::enumName<TestWebKitAPI::NonClassMultiWord>' requested here 201 | EXPECT_TRUE(isExpectedEnumString("FooBar"_s, enumName(FooBar))); | ^ /home/test/WebKitBuild/JSCOnly/Release/WTF/Headers/wtf/EnumTraits.h:212:33: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'V' 212 | constexpr std::span<const char> enumName() | ^ /home/test/WebKitBuild/JSCOnly/Release/WTF/Headers/wtf/EnumTraits.h:267:9: error: no matching function for call to 'enumName' 267 | enumName<static_cast<E>(static_cast<std::underlying_type_t<E>>(Is) + min)>()... | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/test/WebKitBuild/JSCOnly/Release/WTF/Headers/wtf/EnumTraits.h:212:33: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'V' 212 | constexpr std::span<const char> enumName() | ^ /home/test/WebKitBuild/JSCOnly/Release/WTF/Headers/wtf/EnumTraits.h:267:9: error: no matching function for call to 'enumName' 267 | enumName<static_cast<E>(static_cast<std::underlying_type_t<E>>(Is) + min)>()... | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
Attachments
repro.cpp
(5.78 KB, text/plain)
2025-03-13 21:58 PDT
,
Fujii Hironori
no flags
Details
repro2.cpp
(342 bytes, text/plain)
2025-03-13 22:33 PDT
,
Fujii Hironori
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Philippe Normand
Comment 1
2025-03-13 08:19:45 PDT
Workaround, pass -DUSE_CXX_STDLIB_ASSERTIONS=NO to cmake.
Philippe Normand
Comment 2
2025-03-13 08:24:07 PDT
Nevermind... Well I don't know what's going on, not familiar enough with C++ templates machinery.
Fujii Hironori
Comment 3
2025-03-13 13:05:42 PDT
***
Bug 289712
has been marked as a duplicate of this bug. ***
Fujii Hironori
Comment 4
2025-03-13 21:58:50 PDT
Created
attachment 474566
[details]
repro.cpp I created a repro. Is this a clang-20 bug?
https://godbolt.org/z/hThvd3oP6
katoshi1337
Comment 5
2025-03-13 22:04:38 PDT
Thanks a lot. I resolved the issue by compiling it with clang-19. My original report came from clang-21. I initially used clang-14 for compilation, which last worked around March 1st, but it broke due to a different issue. This led me to switch to clang-21 for testing.
Fujii Hironori
Comment 6
2025-03-13 22:33:32 PDT
Created
attachment 474567
[details]
repro2.cpp I created another repro.
https://godbolt.org/z/nYYM7nvYs
Michael Catanzaro
Comment 7
2025-03-17 12:40:09 PDT
Both of your reproducers notably fail to build when using older versions of Clang, but WebKit builds fine until Clang 20.
Fujii Hironori
Comment 8
2025-03-17 13:06:33 PDT
Oh. You are right. I did a mistake while reducing. But, I think it points the problem. Clang 20 can compile the upstream Magic Enum C++. It checks if a enum value is valid.
https://github.com/Neargye/magic_enum/blob/a413fcc9c46a020a746907136a384c227f3cd095/include/magic_enum/magic_enum.hpp#L767
Philippe Normand
Comment 9
2025-03-17 13:15:50 PDT
But our EnumTraits.h seems to have significantly diverged from upstream, hasn't it?
Fujii Hironori
Comment 10
2025-03-17 13:26:27 PDT
Yup. I'm going to try manually import the part.
Keith Miller
Comment 11
2025-03-17 13:30:21 PDT
Our version is a semi-reimplementation to reduce compile times. That said, you could try `std::bit_cast` instead of `static_cast` and see if the issue goes away. It worked for the godbolt repro anyway.
Fujii Hironori
Comment 12
2025-03-17 15:23:20 PDT
I tried `std::bit_cast` approach. But, I got another error.
https://godbolt.org/z/j5s8TdqdT
I tried some ways to workaround this problem with std::bit_cast. But, no luck so far.
Fujii Hironori
Comment 13
2025-03-17 18:32:44 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/42597
EWS
Comment 14
2025-03-18 12:36:19 PDT
Committed
292321@main
(654f0c3862f7): <
https://commits.webkit.org/292321@main
> Reviewed commits have been landed. Closing PR #42597 and removing active labels.
Radar WebKit Bug Importer
Comment 15
2025-03-18 12:37:18 PDT
<
rdar://problem/147340387
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug