[Issue 9100] Weird behavior on template instance argument

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 30 19:24:43 PST 2012


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



--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2012-11-30 19:24:41 PST ---
This is a root cause of some 2.061head regressions - bug 9091, bug 8972, and
bug 8971.

If you use __traits() to get member symbol inside class/struct member function,
the found member symbol will have the implicit 'this'.
Passing the __traits result to the template argument will caught the *bug*
which I explained here.

class C {
  int var;
  void test() {
    __traits(getMember, C, "var");  // same as this.var -> DotVarExp
    alias t = Id!(__traits(getMember, C, "var")); // same as Id!(this.var),
hit!
  }
}
void main() {
  __traits(getMember, C, "var")  // same as C.var == Just a symbol
  alias t = Id!(__traits(getMember, C, "var")); // same as Id!(C.var), no
problem
}

Therefore, I think this is an important semantic analysis bug which should be
fixed.

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