www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9117] New: format fails if opCast and this alias are both defined in an aliased struct

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

           Summary: format fails if opCast and this alias are both defined
                    in an aliased struct
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: puneet coverify.org



---
This is a reduced code. Does not compile with released DMD or with github
snapshot. Strangely it compiles without any error if the opCast operation is
commented out. Note that the opCast operation casts to frop, which is totally
unrelated.

struct Bar {
  Foo foo;
  alias foo this;
  string toString() {
    return "Bar";
  }
}

struct Frop {}

struct Foo {
  int n = 0;
  alias n this;
  T opCast (T) () if (is(T == Frop))
  {
    return Frop();
  }
  string toString() {
    return "Foo";
  }
}

void main() {
  import std.stdio;
  Foo foo;
  writeln(foo);            // no issues
  Bar bar;
  // Compiles if either the alias or opCast in Foo are commented out
  writeln(bar);            // does not compile -- should just print "Bar"
}

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


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

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



https://github.com/D-Programming-Language/phobos/pull/994

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




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

https://github.com/D-Programming-Language/phobos/commit/75064f6be11c61e4cd7aaef70a982fc0e8fc1cef
fix Issue 9117 - format fails if opCast and this alias are both defined in an
aliased struct

https://github.com/D-Programming-Language/phobos/commit/b3c60e3c9f1b6eef54b687bf75b5b20cbe705877


Issue 9117 - format fails if opCast and this alias are both defined in an
aliased struct

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


Alex Rønne Petersen <alex lycus.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |alex lycus.org
         Resolution|                            |FIXED


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