The following code won't compile: int function() foo(int i); int* p; void main() { foo(*p)(); } because foo(*p)() looks like a C-style declaration of p being a pointer to a function that returns type foo. Too work around, add parentheses: (foo(*p)()); I can't see any way to fix this without dispensing with C style function pointer declarations.
> I can't see any way to fix this without dispensing with C style function pointer declarations. Seems very reasonable to remove these to me
(In reply to comment #0) > C-style declaration of p being a pointer to a > function that returns type foo. foo doesn't look like type to me, it's rather a forward declaration of a function. So compiler just needs to distinguish functions from types.
That would be a dependency of parsing on semantic analysis, which is something D by design doesn't have. I agree that C-style function pointer declarations should be thrown out, just as C-style cast syntax has been already.
*** Issue 3980 has been marked as a duplicate of this issue. ***
The disambiguation rule for "is it a declaration or a statement" is resolved by the rule "if it looks like a declaration, it is a declaration". The behavior you're seeing is as designed.
http://www.dsource.org/projects/phobos/changeset/2149
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル