www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10810] New: wrong forward reference error when using return type deduction and a cyclic call flow

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

           Summary: wrong forward reference error when using return type
                    deduction and a cyclic call flow
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: henning still-hidden.de



PDT ---
auto a() { b(); }
auto b() { a(); }

---
main.d(2): Error: forward reference to a
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 12 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10810


timon.gehr gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timon.gehr gmx.ch



I think this is expected behaviour and this issue is an enhancement.

Exactly which additional cases do you want to make work?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 12 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10810




PDT ---
What do you mean with "additional cases"? The return types of these functions
don't depend on each other. The code should compile just like this does:

void a() { b(); }
void b() { a(); }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 12 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10810





 What do you mean with "additional cases"?
The D programs that compile after the fix that wouldn't have compiled before.
 The return types of these functions don't depend on each other.
Indeed, but in order to fix this issue, we need a computationally decidable notion of dependence of function return types. Currently, this is quite conservative. Analysis of any function is suspended if a function call with unresolved return type is encountered, until this return type has been resolved. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 12 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10810


Henning Pohl <henning still-hidden.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor



PDT ---
 The D programs that compile after the fix that wouldn't have compiled
 before.
I just wondered what DMD would do when I throw this at it. Of course those return type depencies can get awfully complex and can involve tons of functions.
 Indeed, but in order to fix this issue, we need a computationally decidable
 notion of dependence of function return types.
And it will be hard to get this implemented. The current behavior is neither surprising nor dangerous. De facto no one will encounter this bug so I will lower the importance to minor. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 12 2013