<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56707>56707</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Unexpected error when using a decltype(auto) NTTP in an out-of-line class template member definition
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++17,
clang:frontend,
regression,
rejects-valid
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
miyuki
</td>
</tr>
</table>
<pre>
Consider the following code:
```C++
template<decltype(auto) V>
struct S {
int f();
};
template<decltype(auto) V>
int S<V>::f() { return 1; }
```
Clang, starting with v 9.0 and up to the current trunk version, rejects the code:
```
$ clang -std=c++17 test.cc
<source>:7:11: error: nested name specifier 'S<V>::' for declaration does not refer into a class, class template or class template partial specialization
int S<V>::f() { return 1; }
~~~~~~^
```
Clang 8 and recent versions of GCC accept the code without errors.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydU8Fu2zAM_Rr5QiRw7Di2Dz50TrvbMKDd7opEO1oVyZDkdN3Xj5LTZQ0GDFugJDL1RPK9Rx-sfO16a7yS6CAcEQartX1RZgRhJbLyjuV7lr_97vJl9az4EFeKBjxNmgcC9xKFDq8TsqLhc7CsaOErK-8XnA9uFgEegdWXm0AfZQIMhCcsKy9xVu-v-3-qEbM9EihFqPny7pI7FgWHYXYGNpQcYo33pH6v12tuRlb04AN3IcrxosIRztCuc-BGwjxBsEkxMTuHVJbYmWc4o_PKmnjV4TcUwS-gd2LeVCy2IGI9WPkgWbkXi7qbGgL6sBbigit7b2cncOFW03dDVO4AnbMubgzBUYLhJwQ_oVCDIltZUb-XhALks4OoJHc8UL8gLXowNlDXA90hHS3w2Jb3kUvawJsLQJdvIlOUieulLNfqR0r736bEyWD1_e2q7v_mGTTJHocienJxw4Md4GPfAxcCp_DLkWSqncOioF9n2G12VVNXu7bYZLIrZVu2PAsqaOy-GPxO5KLACQ4vRzQw-zgcHP4wlZ-enj6TkNQPUI2VHVZaGbwV7oSnA0YvBmVU1Cybne6OIUw-WfVAa6Q258Na2BM9aH1--1tNzsYZo0fl_Yxk1UO1q_M6O3btpkQ5tBWXRV7Wjch3bbvlWJcN7qQUmGl-QO07VtGsFb9GjvbR7xhKrwB55awJaOT1xOHo0C9jfo2lYV-dyfsErfaZ6oq8KPK6qDbltimbtcSyaqiZMs8PmIuWbXM8caXXkczaujFzXeJ1mEdPh1r54K-HpJsaDWLqmfKT0EfrupN6nZ9VlhToEv2fy6F1zw">