<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/68108>68108</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Apple Clang: ` std::source_location` returns a wrong results if called in a function parameter.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          H-G-Hristov
      </td>
    </tr>
</table>

<pre>
    This is more of a question. The examples in this article as seen on Compiler Explorer work as expected but in Xcode 15 they return the location of the `std::source_location::current()` call. Could that be a bug in Apple Clang 15.0?

https://www.cppstories.com/2021/non-terminal-variadic-args/

```C++
template <typename... Ts>
struct Logger
{
    Logger(Ts&&... ts, const std::source_location& loc = std::source_location::current())
    {
 std::cout << loc.function_name() << " line " << loc.line() << ": ";
        ((std::cout << std::forward<Ts>(ts) << " "), ...);
 std::cout << '\n';
    }
};

template <typename... Ts>
Logger(Ts&&...) -> Logger<Ts...>;
```

Apple Clang 15 output (wrong):

> % ./nagent
Logger<const char (&)[26], int, int, int, int>::Logger(Ts &&..., const std::source_location &) [Ts = <const char (&)[26], int, int, int, int>] line 281: Alabalanica turska panica 1 2 3 5 

GCC 13.2 output (correct):

>  # ./nagent
int main(int, char**) line 295: Alabalanica turska panica 1 2 3 5 

Apple Clang details:

> % clang --version
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVc1u4zgTfBr60pBAkZYiHXxw5HjmA75jDnsbUFTH5g5FakkqTt5-0ZKdKJhkf7CAYFlksVhd3WSrGM3JIe5Yec_Kw0ZN6ezD7nv2LfseTEz-edP5_nX3eDYRTITBBwT_BAr-mDAm410Oj2cEfFHD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