Summary: immutable structs by default have mutable constructor
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Alex <> 2012-04-24 13:34:32 PDT 
Consider following code:

    immutable struct Foo {
        this(int) { }

        void bar() { }

    int main(in string[] args) {
        auto foo = Foo(1);;

This will not work out, because `bar()` is immutable, but `foo` is not. If
constructor is declared as `this(int) immutable {}`, it will work again.
Default no-arg constructor for immutable structs is already immutable, so
shouldn't other constructor also be considered immutable implicitly, much like
methods are?

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to