This is more of a question. The examples in this article as seen on Compiler Explorer (trunk) 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/
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
This is more of a question. The examples in this article as seen on Compiler Explorer (trunk) 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/
Apple Clang 15 output (wrong):
GCC 13.2 output (correct):
Apple Clang details: