Date: Wed, 2 Oct 2024 11:23:57 +0100
On Wed, 2 Oct 2024 at 10:45, Frederick Virchanza Gotham via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> I reply to Robin and Lénárd:
>
>
> Robin wrote:
> >
> > That example is potentially ODR breaking as you could have
> > different compilation units that see different "SomeGlobalFunction":s
>
> Lénárd wrote;
> >
> > Even seeing the same functions in different order would be potentially
> ODR-breaking.
>
>
> This can be alleviated by restricting it even further. Previously I wrote:
>
> "A class shall not have a non-static virtual method with the
> parameter list "auto&&... args" unless the inline body of the method
> contains an invocation of a non-template-and-non-variadic function
> with the arguments "static_cast<decltype(args)>(args)..." -- in which
> case the virtual method will be given an instantiation for each of the
> overload signatures of the aforementioned
> non-template-and-non-variadic function."
>
> But we can change "non-template-and-non-variadic function" to
> "non-template-and-non-variadic member function". Since you can only
> have one definition of a class, there won't be any case of one
> translation unit seeing member functions that another translation unit
> doesn't see -- nor any case of seeing them in a different order.
>
It would be technically possible to make this work in very limited
circumstances. But it would be fragile and fail in most cases. Why bother
making a complex change that can only be used in very limited ways, for
very limited benefit? The pros do not outweight the cons.
Once again, this is just "I thought of a thing, let's waste time talking
about it".
std-proposals_at_[hidden]> wrote:
> I reply to Robin and Lénárd:
>
>
> Robin wrote:
> >
> > That example is potentially ODR breaking as you could have
> > different compilation units that see different "SomeGlobalFunction":s
>
> Lénárd wrote;
> >
> > Even seeing the same functions in different order would be potentially
> ODR-breaking.
>
>
> This can be alleviated by restricting it even further. Previously I wrote:
>
> "A class shall not have a non-static virtual method with the
> parameter list "auto&&... args" unless the inline body of the method
> contains an invocation of a non-template-and-non-variadic function
> with the arguments "static_cast<decltype(args)>(args)..." -- in which
> case the virtual method will be given an instantiation for each of the
> overload signatures of the aforementioned
> non-template-and-non-variadic function."
>
> But we can change "non-template-and-non-variadic function" to
> "non-template-and-non-variadic member function". Since you can only
> have one definition of a class, there won't be any case of one
> translation unit seeing member functions that another translation unit
> doesn't see -- nor any case of seeing them in a different order.
>
It would be technically possible to make this work in very limited
circumstances. But it would be fragile and fail in most cases. Why bother
making a complex change that can only be used in very limited ways, for
very limited benefit? The pros do not outweight the cons.
Once again, this is just "I thought of a thing, let's waste time talking
about it".
Received on 2024-10-02 10:25:16