C++ Logo

sg7

Advanced search

Re: [SG7] [isocpp-ext] CWG1962+CWG2362 type of __func__ / __func__ should be constexpr

From: Peter Dimov <pdimov_at_[hidden]>
Date: Thu, 30 Apr 2020 18:22:44 +0300
Herring, Davis wrote:
> > All compilers optimize the above to just "return 'f';", so if
> > __func__[0] varies, so does the result.
>
> Sure, but what does that have to do with using that 'f' in constant
> expressions?

Nothing, of course. It only has to do with

> Perhaps an implementation might generate two different-valued weak symbols
> for "f::__func__", but so long as only one of them is used (by whichever
> weak definition of f is chosen), this seems to work correctly.

Received on 2020-04-30 10:26:03