On 2011-12-20 18:39:02 +0000, Timon Gehr <timon.g...@gmx.ch> said:

On 12/20/2011 07:16 PM, dsimcha wrote:
On Tuesday, 20 December 2011 at 17:46:40 UTC, Jonathan M Davis wrote:
Assuming that the assignment can still take place, then making auto
infer non-
const and non-immutable would be an improvement IMHO. However, there
_are_ cases where you'd have to retain const - a prime example being
classes. But value types could have const/immutable stripped from
them, as could arrays using their tail-constness.

- Jonathan M Davis

Right. The objects would only be head de-constified if Michael Fortin's
patch to allow such things got in. A simple way of explaining this would
be "auto removes top level const from the type T if T implicitly
converts to the type that would result".

Yes, having to use

auto x = cast()y;

is quite annoying, I'd like this change to happen.


BTW: What will happen with cast()classRef once we have head-mutable class references?

Same as pointers. With classRef of type "const(Object)", "cast()classRef" becomes of the head-mutable type: "const(Object)ref".

--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/

Reply via email to