https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104706

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to qingzhe huang from comment #0)
> See code in compiler explorer: https://www.godbolt.org/z/cb8973Ys1

Again, please provide the info requested by https://gcc.gnu.org/bugs (which
clearly says not just a URL to somewhere else).

> struct of size of 0 does have its usage and it is supported by GNU C
> (https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html). However, make_unique
> makes it impossible to create such an unique_ptr because its default_delete
> requires "A" must have non-zero size.

Good, this code is useless. I dispute that it has uses, except as part of
another struct, or with another member present.

Specifically, if you create this object using make_unique<A>() then there is no
additional memory after it, so no way to ever access the array elements
(because there aren't any array elements).

I don't think we want to support this.

Reply via email to