You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just a sample cpp1 function that can no longer be represented in cpp2 syntax due to lack of default arguments.
If I'm wrong about this and there's a way around this please reply and close the bug, thanks!
thanks for the link @gregmarr ... I guess based on that I have to stick to standard cpp syntax for source_location where I need it... guess it's the only good use of default arguments
Thanks! When it's time, it's time... default arguments are now supported, and your source_location example works (on Cpp1 compilers that have source_location):
my_function_name: (
fn: *constchar = std::source_location::current().function_name()
)
= {
std::cout << "calling: (fn)$\n";
}
main: (args) = {
my_function_name();
}
// On MSVC 2022, prints:// calling: int __cdecl main(const int,char **)// On GCC 14, prints:// calling: int main(int, char**)
Just a sample cpp1 function that can no longer be represented in cpp2 syntax due to lack of default arguments.
If I'm wrong about this and there's a way around this please reply and close the bug, thanks!
void debug_function_name(char const *fn = std::source_location::current().function_name())
{
std::println(stderr, "calling: {}", fn);
}
The text was updated successfully, but these errors were encountered: