www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4785] New: auto return of a function with in contract

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

           Summary: auto return of a function with in contract
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2010-09-01 10:38:41 PDT ---
auto foo()
    in {}
    body { return 0; }
void main() {
    foo();
}


DMD 2.048 prints:
test.d(2): no identifier for declarator foo
test.d(2): semicolon expected, not 'in'
test.d(2): Declaration expected, not 'in'
test.d(3): unrecognized declaration

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 01 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4785


jens.k.mueller gmx.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jens.k.mueller gmx.de
           Platform|x86                         |All
         OS/Version|Windows                     |All


--- Comment #1 from jens.k.mueller gmx.de 2011-03-30 10:29:23 PDT ---
I also hit this bug but on Linux and I suppose it fails on all platforms.

My test code is

auto foo()
body { // does not compile if body is specified
    return 0;
}

void main() {}

It fails with latest dmd (v2.052)
test.d(2): function declaration without return type. (Note that constructors
are always named 'this')
test.d(2): no identifier for declarator foo()

This bug makes using contracts and auto return type impossible. Maybe it's
importance should therefore be increased.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 30 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4785


kennytm gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kennytm gmail.com


--- Comment #2 from kennytm gmail.com 2011-04-20 12:03:17 PDT ---
Maybe issue 5867 is the same as this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 20 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4785


Maksim Zholudev <maximzms gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maximzms gmail.com


--- Comment #3 from Maksim Zholudev <maximzms gmail.com> 2011-06-10 06:53:11
PDT ---
DMD v2.053 on Linux do not accept the following code:

----------
auto F1() {return 0;} // OK

int F2() body {return 0;} // OK

auto F3() body {return 0;} // ERROR: function declaration without return
type...

void main()
{
   F1();
   F2();
   F3();
}
----------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 10 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4785


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |k.hara.pg gmail.com


--- Comment #4 from Kenji Hara <k.hara.pg gmail.com> 2011-07-14 04:28:47 PDT ---
https://github.com/D-Programming-Language/dmd/pull/147

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 14 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4785


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

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


--- Comment #5 from Kenji Hara <k.hara.pg gmail.com> 2011-12-03 10:04:27 PST ---
*** Issue 7060 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 03 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4785


SomeDude <lovelydear mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear mailmetrash.com


--- Comment #6 from SomeDude <lovelydear mailmetrash.com> 2012-04-21 15:34:01
PDT ---
DMD 2.059:

PS E:\DigitalMars\dmd2\samples> rdmd bug.d
bug.d(1): function declaration without return type. (Note that constructors are
always named 'this')
bug.d(2): no identifier for declarator foo()
PS E:\DigitalMars\dmd2\samples>

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 21 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4785



--- Comment #7 from bearophile_hugs eml.cc 2012-04-24 18:32:31 PDT ---
I hope the patch will be merged in some more months.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 24 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4785



--- Comment #8 from github-bugzilla puremagic.com 2012-05-02 18:25:29 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/bd0e45f56f869da03baf89d8b530a9a2afc5f561
Issue 4785 - auto return of a function with in contract

https://github.com/D-Programming-Language/dmd/commit/007b936e0970666c7698ad7c3b2c2b3da2d8cbc0
Merge pull request #147 from 9rnsr/fix4785

Issue 4785 & 5039 Allow auto return function with contracts

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 02 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4785


Walter Bright <bugzilla digitalmars.com> changed:

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


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