<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94585>94585</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang fails to resolve some names inside templates/lambdas under -fdelayed-template-parsing or --driver-mode=cl
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
higher-performance
</td>
</tr>
</table>
<pre>
[Repro](https://godbolt.org/z/fM8rdcG4d):
```
struct Outer
{
template<class = void>
static void foo()
{
struct S
{
};
auto const g = []()
{
struct H
{
static void f()
{
typedef S S; // error: unknown type name 'S'
}
};
};
}
};
int main()
{
Outer().foo();
}
```
Both Clang and MSVC compile this fine with eager template parsing, but clang-cl fails to compile it due to delayed template parsing.
This makes clang-cl incompatible with MSVC.
Note that MSVC always handles this fine, regardless of `/permissive[-]` or `/Zc:twoPhase[-]`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VE2vmzAQ_DXmsiIiBkI4cMhH015eWzVVD70ZvID7jI1skyj99ZUh33mVogDj8ezOjmVmrWgUYkHSNUm3ARtcq03RiqZFE_Zoam06pioMSs1PnvUDe6NJuiV02TrXWxKvCN0Rums0L7V0M20aQnd_Cd3Vb0vDq88JJzT3tGhLohVZROff-GmdGSoH3waH5kzI1ueXKHfY9ZI5JPGmksxaIPEWDlpwEn-6kqxjTlQjDLXWhC59vcvqvdxIHuvt77EnCsm2JH5A2OA0VFpZB83YwjSt50qvStd6X57gV-KzkQ_E_7_Tj-rUI8ca9rAn8RpgCgXQGG1IvIJBvSt9VOB5oFiHQGi2JzT7qMT2pd3nkTwj1y0PuP8XykHHhHowdGdiin5cnN3iu2pchR_PzVq7FjaSqQaY4vC2_7WBSne9kAiuFRZqoRCOwrWArEEDl6MEPTNWqIbQDZSDg8prhJWEmglpYQx6khEO-IAe4SjZCfmLxuze509ftWPvaG-aQnkx5kQpz834Rh-2fdXOd8zc5IHJIztZaJniEu3Nim_XYMOMhy3oGvwo6K5H0wlrxQFJug79oVxEoM159XdF4pU76u8ts3eEWcCLmOdxzgIs5tk8W6R5NF8GbYFpjWnOcrbERZKUOI8pztMkSzKa8KQsA1HQiCbRIlpEWRzNl7M05YuswjRO56yKOJIkwo4JOZPy0PnLIBDWDljkSbpMA8lKlHa8bSgdx0Qo9RePKTw_LIfGkiSSwjp7U3DCSSymtK8xGbRaHhCs7qYDbUEoKzheY7KE7iTrSs4sDIqjgbA-RxleOOE5Sj-zMORGHNCEneZI4m0lg8HI4umaE64dylmlO68uD5dH2Bv9BytH6G407ItPng8F_RcAAP__fEmQww">