This is what it reads to me.
You have declared a function with a specific return type but it's definition is unable to fulfill it.
That's by definition an invalid definition.
What you are asking is for a way for compilers to accept invalid definitions.

To me the answer is self-evident, the definition is invalid, no support required.



From: Std-Proposals <std-proposals-bounces@lists.isocpp.org> on behalf of Frederick Virchanza Gotham via Std-Proposals <std-proposals@lists.isocpp.org>
Sent: Tuesday, May 20, 2025 9:46:19 AM
To: std-proposals <std-proposals@lists.isocpp.org>
Cc: Frederick Virchanza Gotham <cauldwell.thomas@gmail.com>
Subject: [std-proposals] attribute [[unevaluated]]

Sometimes we write a function without any intention of it ever being
invoked. Consider the following function to get a function's return
type:

    template <typename ReturnType, typename... Params>
    ReturnType ToReturnType( ReturnType (*)(Params...) )
    {
        // empty function body
    }

The only reason we write a function like this is to use 'decltype' on
its invocation, some thing like:

    typedef decltype( ToReturnType(my_function_pointer) ) ReturnType;

Most compilers will warn that the above function doesn't have a return
statement, so I suppress the warning with:

    template <typename ReturnType, typename... Params>
    ReturnType ToReturnType( ReturnType (*)(Params...) )
    {
        return std::declval<ReturnType>();
    }

It though it might be more intuitive though to mark the function:

    template <typename ReturnType, typename... Params>
    [[unevaluated]] ReturnType ToReturnType( ReturnType (*)(Params...) ) {}

This would have two effects:
    (1) The compiler will refuse to use it in an evaluated context
    (2) The compiler won't give a warning/error about a missing return statement
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals