Bug 1354 – Can use function prototype in typedef and alias.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2007-07-20T15:32:40Z
Last change time
2019-05-21T00:26:38Z
Keywords
accepts-invalid
Assigned to
No Owner
Creator
Aziz Köksal

Comments

Comment #0 by aziz.koeksal — 2007-07-20T15:32:40Z
typedef int[] func(A,B,C)(int bla); // works with alias instead of typedef, too. func foo; // Error: variable foo cannot be declared to be a function func* foo; // works
Comment #1 by shro8822 — 2007-07-20T15:45:42Z
Why should having a typedef to a function type be an issue? It might be but I'm not seeing it.
Comment #2 by aziz.koeksal — 2007-07-31T04:44:03Z
(In reply to comment #1) > Why should having a typedef to a function type be an issue? > > It might be but I'm not seeing it. > The problem is that the compiler ignores the template parameter list. The compiler should either flag this as an error or allow for such declarations. A declaration like: typedef A[] func(A, B)(B bla); should be seen by the compiler as: template func(A, B) { typedef A[] func(B bla); } Instantiate template: func!(int, int)* foo;
Comment #3 by pro.mathias.lang — 2019-05-21T00:26:38Z
Typedef is gone