On 4/28/2020 4:46 PM, Gabriel Dos Reis via Ext wrote:
Leave it alone.

+1

Stability/compatibility is a major feature.



-- Gaby

From: Ext <ext-bounces@lists.isocpp.org> on behalf of JF Bastien via Ext <ext@lists.isocpp.org>
Sent: Tuesday, April 28, 2020 11:10:02 AM
To: Evolution Working Group mailing list <ext@lists.isocpp.org>; sg7@lists.isocpp.org <sg7@lists.isocpp.org>
Cc: JF Bastien <cxx@jfbastien.com>
Subject: [isocpp-ext] CWG1962+CWG2362 type of __func__ / __func__ should be constexpr
Hello EWG and Reflection,

We looked atCWG1962and CWG2362 during our telecon (notes here). We agree that there's a language issue.

Using the details below, I'd like y'all to consider: do we want to fix this issue, or leave it as-is because better mechanismswill eventually lead us to deprecate __func__?

Richard summarized both issues thusly: The deep question here is about __func__ and the ODR. Does EWG want implementations to somehow behave as if __func__ is the same in all copies of an inline function (in which case it can have an array type and be usable in constant expressions, but the demangling algorithm used to construct it becomes part of the ABI), or does EWG want implementations to behave as if __func__ may differ between copies, so is in effect not known until runtime (in which case it must have either pointer or incomplete array type, and its value is not usable in constant expressions but its address could still be usable).

Consulting with Hana, it indeed seems like Reflection can replace __func__:
namespace std::meta {
consteval auto name_of(info entity)->std::string {...};
consteval auto display_name_of(info entity)->std::string {...};
}
consteval auto current_function()->info {...}

Further, Hana points out that C++20 has the following:
std::source_location::function_name

Cherry on top: I don't think WG14 will adopt either of these soon. If we deprecate __func__ we're creating extra divergence between C and C++.

Given these facts: do we want to spend time fixing __func__, or do we want to leave it alone?

Thanks,

JF



_______________________________________________
Ext mailing list
Ext@lists.isocpp.org
Subscription: https://lists.isocpp.org/mailman/listinfo.cgi/ext
Link to this post: http://lists.isocpp.org/ext/2020/04/13425.php