<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/129636>129636</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`__cpp_pack_indexing` value does not respect command-line C++ version
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
elbeno
</td>
</tr>
</table>
<pre>
This code produces the same output whether compiled with `-std=c++20` or `-std=c++26`:
```cpp
template <int I, auto... Vs>
consteval auto nth() {
#if __cpp_pack_indexing >= 202311L
return Vs...[I];
#else
return 0;
#endif
}
int main() {
return nth<0, 1>();
}
```
This _might_ be technically allowed (I am not sure if it's strictly specified)? But if so it's not useful. It's at odds with what GCC does -- and indeed at odds with what clang does with other feature macros -- and it leads to surprisingly provoking a `-Wc++-26-extensions` warning: https://godbolt.org/z/fvjWcYqPG
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsU02PozgQ_TXFpRTkmITQBw752Ixa2sMeVjPaU2TsAjxjbBYXyfT--pUhva0dtWQJ5Hr1_PzqWcVoO09Uw_4E-0umZu7DVJNryIesCeat_rO3EXUwhOMUzKwpIveEUQ2EYeZxZnz0xD1NqMMwWkcGH5Z7hFJsIhsoLhrkCeRJCigFhumTSgmlgOIIYlmlWJceRxBHpmF0igmhOFvP-AryjGrmkOc5fo1Q_AbiqIOPTHfllgp67kFWIF8QDqdEKQvb4u2mx_E2Kv3jZr2hn9Z3mNqLC0ohi-32dxBHnIjnyePXmOc57E-vsL9A8SQhFylh3kHio-KNbdPv4bLeIkkdlPX_0_FfYxJYnEW6yjZJWEBPspXh3YSVbZnCbbBdzzdsCJl0761Wzr2hci48yCDI6hXVgD4wxnkitC1aBnmIGHmymt0bxpG0bS2Z5bgrnmZOsBjekal5jtTOLsfXdUsxBmPiOtVHrxi_nM9oAkXcbFB5g8lNMp8AtVO-W6HLZlhy0pLipG9QegofJIyOlInIIckfJxut79xbyt09_EjDUkt0vj1Ts5Hlhn4y-WiDjylbDzV56zsojtgzjzFFSl5BXrtgmuA4D1MH8voPyGt7__5N__X3H19AHDNTF-aleFEZ1dvDbiv2Vbk7ZH0t1b4thXrZbo1pyka1TdsedCV2Vdk0lWgzW0sh96IQO1HInTjku6pqW3FQrRLakK5gJ2hQ1uXO3Yd0fGZjnKneypeyKDOnGnJxeX1SenrgUgUp02Oc6tS0aeYuwk44Gzl-0LBlRzWU4pNQJyvuys20Op9GOlGaPKcnOihvNs56wvPqI95pShZm8-TqX3yz3M9NrsMA8prOfn424xS-k2aQ10VxBHl9Xuley38DAAD__wwcW-U">