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

    <tr>
        <th>Summary</th>
        <td>
            inherited constructor causes `source_locationI::current()` to point at wrong line
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          snarkmaster
      </td>
    </tr>
</table>

<pre>
    In this code (https://godbolt.org/z/dPhq718e5), `Foo foo{}` ends up with an incorrect `source_location`, while `Foo foo{Potato{}` is fine.

It looks like `using Bar::Bar` generates a default ctor for `Foo`, which becomes the evaluation site for `source_location::current()`.

I'm not a standards lawyer, but I didn't find any suggestion that what we're seeing here is the specified behavior. And for default arguments, the the clear intent of the C++ standard is for default arguments to be evaluated at the **call site**. The current behavior violates at least the spirit of that rule. It also breaks the typical `source_location`-stamping technique.

```
#include <iostream>
#include <source_location>

struct Potato {};

struct Bar {
 std::source_location sl_;
  explicit Bar(Potato = {}, std::source_location sl = std::source_location::current())
      : sl_(sl) {}
};

struct Foo : Bar { // `foo.sl_` points here on GCC & clang
  using Bar::Bar;
}; // `foo.sl_` points here on MSVC

int main() {
  Foo foo{}; // Why isn't `sl_` pointing here?
  std::cout << "foo @ line " << foo.sl_.line() << std::endl;
  Foo foo2{Potato{}}; // But this is fine!
  std::cout << "foo2 @ line " << foo2.sl_.line() << std::endl;
  return 0;
}
```


</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVU1v4zYQ_TX0ZbAGTdmSfdBB9q6LHAos0KI9LihyLLGhSS85jJv--oKUlWyy3n4E8ZeGfPPezONQxmgGh9iyzZ5tPi5kotGHNjoZHs8yEoZF7_Vz--CARhNBeY3AxHYkukRWdUwcmTgOXvfe0tKHgYnjX0wc9efxa7Pa4oaJHRMHYDU_eg8n71mzZ81HVnNApyOkC1wNjSAdGKd8CKg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