<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64996>64996</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang: Type alias causes 'use of undeclared identifier' error only when target is x86_64-pc-windows-msvc
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jo-rn
</td>
</tr>
</table>
<pre>
[https://godbolt.org/z/h4586bxh5](https://godbolt.org/z/h4586bxh5) (clang (trunk), msvc v19.latest)
Reduced code:
```c++
template<class V>
struct S1 {
static void F1() {
using Type = int;
struct S2 {
static Type F2() {
return Type();
}
};
}
};
template struct S1<void>;
```
Error only occurs when `S1` is templated.
`clang -target x86_64-pc-linux-gnu -std=c++17 -c test.cpp`: No errors
`clang -target x86_64-pc-windows-msvc -std=c++17 -c test.cpp`:
```
test.cpp:8:24: error: use of undeclared identifier 'Type'
8 | return Type();
| ^
test.cpp:6:16: note: in instantiation of member function 'S1<void>::F1()::S2::F2' requested here
6 | struct S2 {
| ^
test.cpp:14:16: note: in instantiation of member function 'S1<void>::F1' requested here
14 | template class S1<void>;
| ^
1 error generated.
```
`cl /std:c++17 /c test.cpp`: No errors
Clang versions tested: 17.0.0-rc3 16.0.6 15.0.7 14.0.0
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVU1z8yYQ_jXry440AvR50EGxo2MPTafXjgxrm7cycgE5SX99B_wZN2neQzUajNkPnod9tAzO6a0haqF4gmK1GGa_m2z7Y0qsWawn9R4MO-8PDkQHvAfebye1nkafTnYLvP8beL_Li7pcv-0KKFbA65935w0Cr-U4mG2YeDubP4E3wJe4d0eJR9ak4-DJ-bCarSDrTuOvpGZJCuWkKOx0MpXZ6ZXAn8IbVz3tDyEHiKUcB-fwdxDPJ5PzdpYeXxhCdfZGRHR-8FricdIKewa8jjjvPcIzO222-Nv7gRDECrXxIJ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