On Wednesday, 20 August 2014 at 15:08:52 UTC, Peter Alexander wrote:
On Wednesday, 20 August 2014 at 14:52:59 UTC, ketmar via Digitalmars-d wrote:
On Wed, 20 Aug 2014 14:44:40 +0000
Peter Alexander via Digitalmars-d <[email protected]> wrote:

Well, the return type is already the common type of all return paths
no, it's not. the return type will be taken from the first return
statement in code.

auto foo() {
  if (1) return 1;
  return 2.0;
}

This returns double. Try for yourself.

Then either the compiler or the documentation is wrong :-(
"If there are multiple ReturnStatements, the types of them must match exactly."
http://dlang.org/function#auto-functions

Reply via email to