<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55769>55769</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang failed to use std::source_location::current() in default argument
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++20
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ChuanqiXu9
</td>
</tr>
</table>
<pre>
See https://godbolt.org/z/r68nn8snr
Clang failed to compile the following example while gcc and MSVC accept it both:
```C++
#include<source_location>
#include<iostream>
void test_source_location(std::source_location src = std::source_location::current()) {
std::cout << "called at " << src.line() << "\n";
}
int main() {
test_source_location();
}
```
The use here of std::source_location::current() is recommended. So it should be the problem of clang.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVU8mS2yAQ_Rp0oaKSwbKtgw4eOXPLyalUblMsbYkUAodlJsnXp7HijMvJHEbVYukHrx90I73-2R8B6JTSORK-J-wRbfRaeptqH0ac_cI_bHbO7aILpDmQZr-0gxVupCdhLGiaPFV-PuOYpgnoyVvrXwzi8EPMZ_S-TAUblaLCafrp-GWgQik4J2oSlT5NJfzCvmkWGwh7KLZ4GTdO2ayB8CH6HBQ8Wa9EMt4R_vE_i4yPKYCYX9FL--wNyoWYnu5Z2C4mXWTw_R1EY1CU8AN9a8HiVDkEcAmJCOvQKNn-UU_x-7tX-ZyQbUCjhDElbLlBkcrk6seAtTUOFq6b1aQdXOn49V62h9vTGZfoLIy77rsV8Mahi9Z_2a5JuCX_jJnNEcsFAlB_es9tUBNpACyRGZwGXdOjL4mPk89WU7lUzTl4aWEu1KoUV72ErXTPdcc7USWTLPT3hVckvUuKoxpOIttERRgzKkpVDra_ewUmTVnWKBkn1j5fuw-o8hsoJHs0MWaIOGjb7aarpn632snVWvFT121lCxLWTHMADU3LJCKVFRJs7En7UBK_1DdrLmk9VKZnDWNNy5uG8027rtm240JveNd2fNXJjqwbwOTauugoz7MK_UWSzGNE0JqY4isoYjSjA7iEQ36R0-RDP0xZuO_ma-6qywH6i_rffhA9Rw">