Thread overview
[Issue 3286] New: Default parameter prevents solution of inter-module circular dependency
Sep 03, 2009
hskwk@inter7.jp
Sep 03, 2009
HOSOKAWA Kenchi
[Issue 3286] Default parameter prevents to resolve inter-module circular dependency
Sep 18, 2009
Rainer Schuetze
Oct 13, 2009
Walter Bright
September 03, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3286

           Summary: Default parameter prevents solution of inter-module
                    circular dependency
           Product: D
           Version: 2.032
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: hskwk@inter7.jp


module a;
import b;
import c;

class A {
    static __gshared A a;
    void f(B b) {}
    void g(C c) {} // <- Error: identifier 'C' is not defined
}

////////////
module b;
import a;
class B { void f(A x = A.a) {} }

////////////
module c;
import a;
class C { void f(A x = A.a) {} }



There is no problem if class A, B and C are in the same module.
So this dependency is valid and the error is specific for inter-module circular
dependency.

If default parameter "= A.a" for B.f is removed, it goes well. There is no problem if A.a appeared in the body of B.f.

It seems that the compiler tries to recognize the semantics of default
parameter A.a when it is reading declaration of B.f.
Default parameters are usually hint for the expressions which call the
functions with default parameters, this behavior is inexplicable.


This error is a regression between 2.031 and 2.032.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 03, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3286





--- Comment #1 from HOSOKAWA Kenchi <hskwk@inter7.jp>  2009-09-03 08:22:24 PDT ---
Sorry, this error is NOT a regression between 2.031 and 2.032.
This error is occur with 2.031.
I found similar error which is a regression between 2.031 and 2.032, and I was
confused.
Sorry.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 18, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3286


Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |r.sagitario@gmx.de


--- Comment #2 from Rainer Schuetze <r.sagitario@gmx.de> 2009-09-18 00:49:24 PDT ---
The patch in issue 3301 also fixes this issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 13, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3286


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2009-10-13 13:47:07 PDT ---
Fixed dmd 1.049 and 2.034

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