Thread overview
[Issue 8307] inconsistent treatment of auto functions
Apr 23, 2014
Andrej Mitrovic
Apr 23, 2014
timon.gehr@gmx.ch
Apr 23, 2014
Andrej Mitrovic
Sep 13, 2014
Kenji Hara
April 23, 2014
https://issues.dlang.org/show_bug.cgi?id=8307

Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich@gmail.com
         Resolution|---                         |WORKSFORME

--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
> auto foo(){ return 0; return 0.0; } // ok

Warning: statement is not reachable

> auto bar(int x){ if(x==0) return 0; return bar(x-1)+1; } // error

Error: forward reference to bar

The spec seems correct afaict, unless I'm missing something.

--
April 23, 2014
https://issues.dlang.org/show_bug.cgi?id=8307

timon.gehr@gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |---

--- Comment #3 from timon.gehr@gmx.ch ---
(In reply to Andrej Mitrovic from comment #2)
> 
> The spec seems correct afaict,

???

> unless I'm missing something.

In 'foo' the types of the two return expressions do not 'match exactly', yet it is accepted. In 'bar' according to the spec the return type is settled after the first return statement, hence there would _not_ be a circular dependency.

--
April 23, 2014
https://issues.dlang.org/show_bug.cgi?id=8307

--- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
(In reply to timon.gehr from comment #3)
> In 'foo' the types of the two return expressions do not 'match exactly', yet it is accepted.

There's an error with -w though, so it's caught one way or the other. Although maybe we're just lucky here.

> In 'bar' according to the spec the return type is settled
> after the first return statement, hence there would _not_ be a circular
> dependency.

Ah, ok then.

--
September 13, 2014
https://issues.dlang.org/show_bug.cgi?id=8307

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #5 from Kenji Hara <k.hara.pg@gmail.com> ---
Language specification fix: https://github.com/D-Programming-Language/dlang.org/pull/651

--
November 27, 2014
https://issues.dlang.org/show_bug.cgi?id=8307

--- Comment #6 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dlang.org

https://github.com/D-Programming-Language/dlang.org/commit/15259b7319c1a7c7782888bec28c8d5acdeb317f fix Issue 8307 - inconsistent treatment of auto functions

https://github.com/D-Programming-Language/dlang.org/commit/88d0c0f258f7d78c7729137da83c57cc27d95607 Merge pull request #651 from 9rnsr/fix13336

Issue 8307 and 13336 - fix documentation around return type inference and ref deduction

--
November 27, 2014
https://issues.dlang.org/show_bug.cgi?id=8307

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--
February 19, 2015
https://issues.dlang.org/show_bug.cgi?id=8307

--- Comment #7 from github-bugzilla@puremagic.com ---
Commits pushed to 2.067 at https://github.com/D-Programming-Language/dlang.org

https://github.com/D-Programming-Language/dlang.org/commit/15259b7319c1a7c7782888bec28c8d5acdeb317f fix Issue 8307 - inconsistent treatment of auto functions

https://github.com/D-Programming-Language/dlang.org/commit/88d0c0f258f7d78c7729137da83c57cc27d95607 Merge pull request #651 from 9rnsr/fix13336

--