Thread overview
[Issue 9441] New: struct constructor missed on auto/type-inferred variable definition
Feb 01, 2013
Marco Leise
Feb 02, 2013
Kenji Hara
Feb 19, 2013
Kenji Hara
Feb 19, 2013
Marco Leise
February 01, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9441

           Summary: struct constructor missed on auto/type-inferred
                    variable definition
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: Marco.Leise@gmx.de
            Blocks: 340


--- Comment #0 from Marco Leise <Marco.Leise@gmx.de> 2013-02-01 15:28:13 PST ---
This should compile but doesn't:

  auto x = X(0.123);

  struct X {
    int a;
    this(double) {}
  }

Error: cannot implicitly convert expression (0.123) of type double to int

It works if I reverse the order of declaration for X and x or I don't use type inference for x. E.g. a classical forward reference bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 02, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9441


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-02-02 05:03:28 PST ---
https://github.com/D-Programming-Language/dmd/pull/1598

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 19, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9441



--- Comment #2 from github-bugzilla@puremagic.com 2013-02-18 18:45:03 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/13235c12fa03ba561b41a172627235698750786e
fix Issue 9441 - struct constructor missed on auto/type-inferred variable
definition

https://github.com/D-Programming-Language/dmd/commit/a02b239102eca0127a2dd784c7fec7534c3c69a0 Merge pull request #1598 from 9rnsr/fix9441

[fwdref bug] Issue 9441 - struct constructor missed on auto/type-inferred variable definition

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 19, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9441


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

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


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 19, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9441



--- Comment #3 from Marco Leise <Marco.Leise@gmx.de> 2013-02-19 07:21:09 PST ---
Thanks for the quick fix.

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