Comment #0 by shammah.chancellor — 2015-03-28T16:51:54Z
```
> rdmd test0156.d
test0156.d(19): Error: function expected before (), not foo() of type int
```
```test0156.d
//T compiles:yes
//T has-passed:yes
//T retval:36
// Closure chaining
int main() {
int a = 11;
auto foo() {
int b = 25;
auto bar() {
return a + b;
}
return bar;
}
return foo()();
}
```
Comment #1 by ag0aep6g — 2015-03-28T17:08:36Z
As in issue 14353, dmd needs the ampersand: `return &bar;`. Without it, it's treated as a parentheses-less call.
Comment #2 by shammah.chancellor — 2015-03-28T17:09:54Z
(In reply to ag0aep6g from comment #1)
> As in issue 14353, dmd needs the ampersand: `return &bar;`. Without it, it's
> treated as a parentheses-less call.
Has the spec changed with regards to this? There is not "Symbol.Function" going on in this test.
Comment #3 by ag0aep6g — 2015-03-28T17:37:06Z
(In reply to Shammah Chancellor from comment #2)
> Has the spec changed with regards to this?
I don't know if the spec maybe changed at some point. Could be that a naked function/method symbol without parentheses was treated as a function pointer / delegate in the distant past. I think they've been calls for at least a couple of years, though.
> There is not "Symbol.Function" going on in this test.
It doesn't matter if it's "Symbol.Function" or just "Function".
Comment #4 by k.hara.pg — 2015-03-29T09:16:57Z
(In reply to ag0aep6g from comment #3)
> (In reply to Shammah Chancellor from comment #2)
> > Has the spec changed with regards to this?
>
> I don't know if the spec maybe changed at some point. Could be that a naked
> function/method symbol without parentheses was treated as a function pointer
> / delegate in the distant past. I think they've been calls for at least a
> couple of years, though.
As far as I know (at least from before the D1.000 release), D has always required address operator to take function pointer / delegate from a function identifier.
It's definitely a bug in SDC.