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



--- Comment #2 from luka8088 <luka8...@owave.net> 2011-09-20 08:19:42 PDT ---
The actual problem is:


import std.stdio;

immutable struct a {
  b b1;
}

struct b {
  /*
    void c () { }
      case 1 => Error: function b.c () is not callable using argument types ()
immutable
    void c () immutable { }
     case 2 => Error: function b.c () immutable is not callable using argument
types ()
  */
  void c () { }
}
void main () {

  a a1;
  b b1;

  a1.b1.c(); // case 1
  b1.c();    // case 2

}



Lets say there is a struct b that can be independent and is mutable. On the
other hand we have struct a that has b immutable, by some reason immutable is
not inherited by void c () { }, so by trying to call a1.b1.c(); compiler throws
Error: function b.c () is not callable using argument types () immutable

I also tried a work-around by making void c () immutable { }, but then
independent usage of b throws Error: function b.c () immutable is not callable
using argument types ()


The reason for trying typeof(this) is I was trying to make two functions:
  void c () if (is(typeof(this) == b)) { }
  void c () if (is(typeof(this) == immutable(b))) immutable { }
but since typeof(this) does not indicate immutable I found no work-around.

Until this is resolved, is there any work-around for this situation... or am I
doing something wrong ?

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

Reply via email to