[Issue 8753] Too aggressive expansion for variables which have void initializer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 5 22:12:25 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8753


Kenji Hara <k.hara.pg at gmail.com> changed:

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


--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2012-10-05 22:00:29 PDT ---
>From the discussion in github, I've agreed that this is an invalid issue.

By Don Clugston,
> I am sorry, I'm completely unconvinced by this. If you write: "immutable int ix = void", there is no way, without breaking the type system, that ix could ever be given a value. Such code is simply wrong.
>
> Now we could change the meaning of "= void" to mean, set in a constructor. In that case, "immutable int ix = void;" and "immutable int ix;" are the same. Then no constant folding would ever be performed on something with a void initializer. I think that's a reasonable language change.
>
> But even in this case, the test code should not compile (it's neither in module scope, where there could be a static this, nor in an aggregate where there could be a constructor).
> 
> The situation in bug 3449 is an entirely different issue.

Then, const/immutable local variables which initialized with void is
meaningless.
Such compiler's behavior might not be so bad.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list