[Issue 20876] generated constructor always inout regardless of ability of fields to use inout
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Apr 2 16:41:43 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=20876
--- Comment #12 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
(In reply to Walter Bright from comment #11)
> What it could do is examine each field's copy constructor, and pick the most
> restrictive annotation that is inclusive to all of them. If that doesn't
> work, then fail.
That would be better, but the ideal situation would involve generating multiple
copy constructors if the types being wrapped have multiple, since it is
possible to overload copy constructors on qualifiers. Obviously, it could only
generate the ones which would work with all of the member variables, so you
could easily end up in a situation where only a subset could be generated, but
in many cases, it should work to be able to forward all of the overloads of the
copy constructor - especially when only one of the member variables has a copy
constructor, which will likely be the case a lot of the time.
But either way, right now, as soon as you declare a copy constructor that
doesn't work with the default signature, you're just screwed with any implicit
copy constructors, since the compiler can't generate one that works.
--
More information about the Digitalmars-d-bugs
mailing list