[Issue 6695] typeof(this) does not take into account const/immutable attributes inside member functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 5 17:47:37 PDT 2011


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



--- Comment #10 from Kenji Hara <k.hara.pg at gmail.com> 2011-10-05 17:46:52 PDT ---
This issue is not limited only typeof(this).

struct S
{
  int x;
  void f() immutable {
    static assert(is(typeof(x) == immutable(int)));  // fails!
    static assert(is(typeof(x) == int));  // pass, but it is fake
  }
}

Because typeof(x) inside immutable member function f is translated to
typeof(this.x), and `this` is specially typed as S, then typeof returns int.

-- 
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