[Issue 9441] New: struct constructor missed on auto/type-inferred variable definition

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 1 15:28:14 PST 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 at puremagic.com
        ReportedBy: Marco.Leise at gmx.de
            Blocks: 340


--- Comment #0 from Marco Leise <Marco.Leise at 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: -------


More information about the Digitalmars-d-bugs mailing list