Thread overview
[Issue 9117] New: format fails if opCast and this alias are both defined in an aliased struct
Dec 06, 2012
Puneet Goel
Dec 07, 2012
Kenji Hara
December 06, 2012
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


--- Comment #0 from Puneet Goel <puneet@coverify.org> 2012-12-06 09:56:42 PST ---
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: -------
December 07, 2012
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


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-12-07 07:17:58 PST ---
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: -------
December 08, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9117



--- Comment #2 from github-bugzilla@puremagic.com 2012-12-07 22:17:35 PST ---
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 Merge pull request #994 from 9rnsr/fix9117

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