Bug 261598

Summary: [MSVC][Win] Using C++20's concept cause WinCairo compiler to crash
Product: WebKit Reporter: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: Hironori.Fujii
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Jean-Yves Avenard [:jya] 2023-09-15 02:25:01 PDT
(Using Tools / Test component for lack of a better component)

I added usage of C++20 concept in a PR, WinCairo bots crashes when parsing that file.

https://ews-build.webkit.org/#/builders/32/builds/17174

This is the added code causing an issue:

```
class NativePromiseBase;

template <typename T>
concept IsNativePromise = std::is_base_of<NativePromiseBase, T>::value;

template <typename T, typename U>
concept RelatedNativePromise = requires(T, U)
{
    { IsNativePromise<T> };
    { IsNativePromise<U> };
    { std::is_same<typename T::NativePromiseBaseType, typename U::NativePromiseBaseType>::value };
};
```
Comment 1 Jean-Yves Avenard [:jya] 2023-09-15 02:25:30 PDT
The compiler crashes with:

```
C:\BW\WinCairo-EWS\build\WebKitBuild\Release\WTF\Headers\wtf/TypeTraits.h(134): fatal error C1001: Internal compiler error.
```
Comment 2 Jean-Yves Avenard [:jya] 2023-09-15 03:21:11 PDT
I can confirm that it's just this one:

```
template <typename T, typename U>
concept RelatedNativePromise = requires(T, U)
{
    { IsNativePromise<T> };
    { IsNativePromise<U> };
    { std::is_same<typename T::NativePromiseBaseType, typename U::NativePromiseBaseType>::value };
};
```

that causes the crash
Comment 3 Jean-Yves Avenard [:jya] 2023-10-05 16:32:14 PDT
Wth the migration from mcvc to clang-cl this may no longer be an issue.
Comment 4 Fujii Hironori 2023-10-05 17:38:05 PDT
The migration isn't completed yet. I will remove the #if after the migration is completed.
Comment 5 Fujii Hironori 2024-04-22 01:09:15 PDT
WebKit Windows port hasn't dropped MSVC support yet.
VS 2022 v17.9.6 still reports the internal compiler error for wtf/TypeTraits.h.
Comment 6 Fujii Hironori 2024-05-10 21:45:38 PDT

*** This bug has been marked as a duplicate of bug 274018 ***