[ub] Possible effective type defect
David Krauss
david_work at me.com
Sat Feb 22 06:21:58 CET 2014
Yes, not only does it apply only to lvalue expressions, it only applies with lvalue-to-rvalue conversion, which happens less often in C++ — and when applied to class types, it gets short-circuited to a copy constructor call.
All the examples in the DR refer to lvalue-to-rvalue conversion applied by the comma operator, which doesn’t happen in C++ because value category tends to propagate. Analogous arguments can be formed by replacing them with static_cast to non-reference types. In C++ this unambiguously creates new objects with unique addresses, so type punning by static_cast is either OK for trivially copyable unions (N3797 §12.8/16), or dependent on the copy constructor.
I think it would be better to fill the role of effective type with a concept orthogonal to lvalue-to-rvalue conversion.
- D
On Feb 22, 2014, at 1:10 AM, Gabriel Dos Reis <gdr at microsoft.com> wrote:
> Hi,
>
> The recent (and ongoing) discussion on the lifetime of objects of type at the intersection of C and C++ (what we used to call POD) looked at various aspects of C's notion 'effective type'. Here is one defect filled against it:
>
> http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1762.htm
>
> Please note that it is for the C committee to decide. I am mentioning it here only to the extent that 'effective type' is part of what we are looking at.
>
> -- Gaby
>
> _______________________________________________
> ub mailing list
> ub at isocpp.open-std.org
> http://www.open-std.org/mailman/listinfo/ub
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.open-std.org/pipermail/ub/attachments/20140222/0c5e1994/attachment.html
More information about the ub
mailing list