www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4186] New: Forward reference error from static function with no return type

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

           Summary: Forward reference error from static function with no
                    return type
           Product: D
           Version: future
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2010-05-14 04:59:19 PDT ---
This is D2 code:


static foo() {
    return 1.0;
}
enum double x = foo(); // line 4
void main() {}


dmd v2.045 shows at compile time:
test.d(4): Error: forward reference to foo


The error message is wrong in two ways:
- It doesn't show the error of the missing return type of foo at line 1
- There is a forward reference error that D isn't supposed to generate here

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 14 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4186


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |r.sagitario gmx.de
         Resolution|                            |DUPLICATE


--- Comment #1 from Rainer Schuetze <r.sagitario gmx.de> 2010-05-14 09:11:21
PDT ---
The static without return type implies "auto". This is a variation of bug 2810,
and the patch there also fixes this testcase.

*** This issue has been marked as a duplicate of issue 2810 ***

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