-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Closed
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second party
Description
The following
#include <source_location>
#define BOOST_CURRENT_LOCATION_PTR \
[]( char const* fn ) \
{ \
static constexpr std::source_location loc = std::source_location::current(); \
return &loc; \
}( std::source_location::current().function_name() )
auto f( std::source_location const* loc = BOOST_CURRENT_LOCATION_PTR )
{
return loc;
}
auto g()
{
return f();
}
fails (for Clang trunk and Clang 17, with both libstdc++ and libc++) with
error: cannot take address of consteval function 'current' outside of an immediate invocation
(https://godbolt.org/z/jqqxq6njh)
GCC, MSVC accept.
The example is simplified to the point of doing not much at all, but it started out as something doing useful things. :-)
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second party