Date: Thu, 2 Apr 2026 08:19:13 +0200
On 4/2/26 05:48, Keenan Horrigan via Std-Discussion wrote:
> On Clang you can even have
>
> template<typename T>
> consteval auto get_function() {
> void function(T);
>
> return ^^function;
> }
>
> And then get at the overload generically like 'get_function<int>()'. GCC currently runs into an internal error with that, though: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124756
>
> But basically, I was wondering if this is valid behavior or not. It would be potentially useful, since I'm not aware of another way to get a reflection of a particular overload from an overload set. But I'm unsure if I could rely on this behavior.
EWG decided to make it ill-formed to apply the reflection operator to block-scope
extern declarations; see CWG 3065.
https://cplusplus.github.io/CWG/issues/3065.html
Jens
> On Clang you can even have
>
> template<typename T>
> consteval auto get_function() {
> void function(T);
>
> return ^^function;
> }
>
> And then get at the overload generically like 'get_function<int>()'. GCC currently runs into an internal error with that, though: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124756
>
> But basically, I was wondering if this is valid behavior or not. It would be potentially useful, since I'm not aware of another way to get a reflection of a particular overload from an overload set. But I'm unsure if I could rely on this behavior.
EWG decided to make it ill-formed to apply the reflection operator to block-scope
extern declarations; see CWG 3065.
https://cplusplus.github.io/CWG/issues/3065.html
Jens
Received on 2026-04-02 09:03:52
