C++ Logo

std-proposals

Advanced search

Re: [std-proposals] unimplemented attribute

From: Hans Åberg <haberg_1_at_[hidden]>
Date: Tue, 18 Mar 2025 19:14:08 +0100
I independently suggested the same thing on the GCC Help list:

A compiler may have declarations that leave a series of components undefined. In the case of GCC, this happens with float128_t on MacOS, because it relies on the native C library which comes from Clang and does not have this type. It is fixable by relying on another float128 library if left undefined, but if marked deleted, it can't be fixed.

Semantically, delete means that the function should not be implemented, whereas unimplemented means that the function may be implemented.

So if the compiler finds a function marked unimplemented, it might issue a warning, but overridden if it also finds a version (declared or defined) of the same function without it, in which case no warning is issued.


> On 18 Mar 2025, at 10:47, Samuel Alonso Rodríguez via Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> This attribute is meant to be used in function (member or free, static or non-static, template or non-template) declarations to indicate that the function declaration is left unimplemented (without a definition) with an additional diagnostic message that can be fixed or opt-in thru an unevaluated string literal.
>
> The interesting bit comes from its behaviour: defining any function marked with such attribute, lleads to an ill-formed program (preferably with a diagnostic message), making calls to it be always diagnosable in non-linking time, because no TU can ever define this.
>
> The only catch so far is: redeclarations w/o this attribute would break that assumption. I thought of straight banning redeclarations but I think that’s too much. Maybe forcing redeclarations to have this attribute aswell, once the former declaration has it, could be an interesting idea to explore.
>
> What do you all think?
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2025-03-18 18:14:27