On Wednesday, 24 April 2013 at 04:41:47 UTC, Manu wrote:
The issue is that in this case for instance, the temporary is
conditionally created. Then cannot bind to the enclosing scope.
Conditionally created, in the event you pass an rvalue or not?
What about
binding?
I don't know what you're saying.
As temporaries can now be created all over the place, it is
mandatory to
define them in a much more specific way than it is done right
now.
...I don't follow. There's absolutely nothing special about an
implicitly
created temp vs an explicit one.
I think you misunderstand the problem. It is usually a bad idea
to claim no problem exists when you don't get objections
formulated.
Walter gave a very simple example that defeat you proposal (which
say that temporary live until end of enclosing scope).
In a || b || c, b is conditionally executed. If it require a
temporary, then the temporary can't have a lifetime as you
described as it is conditionally declared (which is impossible
with explicit declarations).
Problems along the same lines occurs when multiple temporaries
are necessary. For instance, in what order they are created, what
happen if the creation of one does throw ?