Thread overview
[Issue 5679] New: Type aliasing "this" from an access function defined in base class confuses the compiler about the type of objects
Mar 02, 2011
Puneet Goel
Apr 23, 2012
SomeDude
Jun 01, 2012
Kenji Hara
Dec 05, 2012
Kenji Hara
March 02, 2011
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


--- Comment #0 from Puneet Goel <puneet@coverify.org> 2011-03-01 17:58:45 PST ---
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: -------
April 23, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5679


SomeDude <lovelydear@mailmetrash.com> changed:

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


--- Comment #1 from SomeDude <lovelydear@mailmetrash.com> 2012-04-22 23:38:39 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: -------
June 01, 2012
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


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2012-06-01 00:49:34 PDT ---
(In reply to comment #1)
> 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: -------
November 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5679



--- Comment #3 from github-bugzilla@puremagic.com 2012-11-19 23:18:44 PST ---
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 Merge pull request #972 from 9rnsr/fix5679

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: -------
December 05, 2012
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


--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2012-12-04 18:29:40 PST ---
(In reply to comment #3)
> 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 Merge pull request #972 from 9rnsr/fix5679
> 
> 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: -------