https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118951
m.cencora at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |m.cencora at gmail dot com
--- Comment #2 from m.cencora at gmail dot com ---
> Also there's nothing like an array return value for functions in C or C++?
Yes, but we can use C++20 CTAD for template parameters to workaround this:
#include <cstddef>
constexpr const auto& my_builtin_FILE()
{
return __FILE__;
}
template <std::size_t N>
struct static_string
{
constexpr static_string(const char* s)
{
auto it = &buf[0];
while (*s != '\0')
{
*it++ = *s++;
}
*it = '\0';
}
char buf[N];
};
template <std::size_t N>
static_string(const char (&str)[N]) -> static_string<N>;
template <class T, static_string File = my_builtin_FILE(), auto Line =
__builtin_LINE()>
struct strong_alias{/*...*/};
using Celsius = strong_alias<unsigned>;
void test(Celsius)
{}
int main()
{
}