<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/62290>62290</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Clang][concepts][regression] Construction of a class `X` nested in class template is ill-formed when `X` has class template friend with specific constraints
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          JMazurkiewicz
      </td>
    </tr>
</table>

<pre>
    As in title. Repro:

```c++
template <class> struct First {
  struct Fail {
    template <bool C>
 requires C
    friend class Second;
  };
};

template <bool C>
  requires C
struct Second {};

auto x = First<void>::Fail{};
```

Build:

```console
PS D:\stl-playground> E:\llvm-project\build-llvm\bin\clang.exe --version
clang version 17.0.0 (https://github.com/JMazurkiewicz/llvm-project.git 3b7d29832296b2f48869c9dbee7a5be060fef0c5)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: E:\llvm-project\build-llvm\bin
PS D:\stl-playground> E:\llvm-project\build-llvm\bin\clang.exe .\clang-reduced.cpp -std=c++20
.\clang-reduced.cpp:4:16: error: requires clause differs in template redeclaration
      requires C
 ^
.\clang-reduced.cpp:13:10: note: in instantiation of member class 'First<void>::Fail' requested here
auto x = First<void>::Fail{};
 ^
.\clang-reduced.cpp:10:12: note: previous template declaration is here
  requires C
           ^
1 error generated.
```

Compiler explorer: https://godbolt.org/z/d6zn9sh67
Discovered while testing `ranges::adjacent_view` from MSVC-STL.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VVGP4yYQ_jXkZWTLhpjED3nIJhupVU-quqeqbycMY4crARdwsre_vsL2ZrO7d6tTpVqWE2aGmY-P-UCEoDuLuCHVHan2CzHEo_ObXz-Jp8H_rfGi5dOicerbZhtAW4g6GszhD-y9I2xLij0pnr-8mF5J6F16R2vEU29ERCBsJ40IgbB7CNEPMsJB-x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