www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5679] New: Type aliasing "this" from an access function defined in base class confuses the compiler about the type of objects

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5679

           Summary: Type aliasing "this" from an access function defined
                    in base class confuses the compiler about the type of
                    objects
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: puneet coverify.org



---
Type aliasing "this" from an access function defined in base class
confuses the compiler about the type of objects. Please see the
reduced test case that I have appended below. I am using dmd2
version 2.052 on a Linux box.

//// file alias_test.d
import std.stdio;
class Foo {
 public int f = 42;
 public void print()  {
   writeln(f);
 }
}
class Base {
 Foo foo;
  property protected final getFoo()  {
   if(foo is null) foo = new Foo();
   return foo;
 }
}
class Derived: public Base {
 alias getFoo this;
}
void main() {
 Derived[] dl;
 Derived d = new Derived();
 d.print(); // prints 42
 writeln("Type of d1 is: ",
         typeid(typeof(d))); // prints Type of d1 is: alias_test.Derived
 dl ~= d; // Error: cannot append type alias_test.Base to type Derived[]
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 01 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5679


SomeDude <lovelydear mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear mailmetrash.com



PDT ---
After changing
class Derived: public Base {
by
class Derived: Base {
in line 15 to remove the deprecation error, the sample compiles and runs fine
on 2.059.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 22 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5679


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid




 After changing
 class Derived: public Base {
 by
 class Derived: Base {
 in line 15 to remove the deprecation error, the sample compiles and runs fine
 on 2.059.
This issue was unintentionally fixed in 2.059, but appears in 2.060head again. https://github.com/D-Programming-Language/dmd/pull/972 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 01 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5679




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/f633fb87736eafe265fe61b34415b99ccfb604af
fix Issue 5679 - Type aliasing "this" from an access function defined in base
class confuses the compiler about the type of objects

https://github.com/D-Programming-Language/dmd/commit/ea0e58bbb20fdd36e8357ae4242458f3835d33b5


Issue 5679 - Type aliasing "this" from an access function defined in base class
confuses the compiler about the type of objects

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 19 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5679


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




 Commits pushed to master at https://github.com/D-Programming-Language/dmd
 
 https://github.com/D-Programming-Language/dmd/commit/f633fb87736eafe265fe61b34415b99ccfb604af
 fix Issue 5679 - Type aliasing "this" from an access function defined in base
 class confuses the compiler about the type of objects
 
 https://github.com/D-Programming-Language/dmd/commit/ea0e58bbb20fdd36e8357ae4242458f3835d33b5

 
 Issue 5679 - Type aliasing "this" from an access function defined in base class
 confuses the compiler about the type of objects
Once the change was reverted, but re-merged. https://github.com/D-Programming-Language/dmd/commit/50fbab4536013314d4500f951928d3f2514bcac4 Finally, the issue was fixed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 04 2012