Summary: Call to immutable method during immutable construction
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD

--- Comment #0 from 2010-11-11 01:39:13 PST ---
According to TDPL p. 294 a call to any non-static method in an immutable
constructor is not allowed.

class A {
    int a;
    this() immutable {
       a = 5;
       fun(); // should not compile

    void fun() immutable {}

compiles with dmd v2.050.
I think the behavior should be clarified. Either in dmd to match TDPL or the
other way round.
I'm going to add a link to a thread on for further

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

Reply via email to