On 9/10/23 4:21 PM, Edward Catmur via Std-Proposals wrote:


On Sun, Sep 10, 2023, 11:41 Tom Honermann via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
On 9/8/23 5:16 AM, Frederick Virchanza Gotham via Std-Proposals wrote:
> Today I discovered the following bug:
>
>      if ( wxIsMainThread ) DoSomething();
>
> The bug here is that 'wxIsMainThread' is a function, and so it should have been:
>
>      if ( wxIsMainThread() ) DoSomething();
>
> I think where we have a function converting to bool -- but not where
> we have a function pointer converting to bool -- the compiler should
> be mandated to issue a diagnostic.

The standard is only able to specify that a diagnostic is produced for a
ill-formed program and even then, the actual diagnostic issued is a
matter of QoI; a conforming implementation can emit "😭" as its
diagnostic. What you are effectively asking for is to make the code
above ill-formed.

Not quite true; the standard could deprecate the conversion. However, implementations would be free to disregard that deprecation and are likely to do so; see eg the rule of five fiasco.

I think what I said is correct. A diagnostic can only be mandated for an ill-formed program.

Tom.