digitalmars.D.bugs - [Issue 2392] New: Parsing ambiguity between function pointer declaration and function call
- d-bugmail puremagic.com (25/25) Oct 04 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2392
- d-bugmail puremagic.com (4/5) Oct 04 2008 Seems very reasonable to remove these to me
- d-bugmail puremagic.com (6/8) Oct 09 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2392
- d-bugmail puremagic.com (11/11) Nov 24 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2392
- d-bugmail puremagic.com (10/10) Mar 17 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2392
- d-bugmail puremagic.com (8/8) Nov 09 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2392
- d-bugmail puremagic.com (11/11) Nov 09 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2392
http://d.puremagic.com/issues/show_bug.cgi?id=2392
Summary: Parsing ambiguity between function pointer declaration
and function call
Product: D
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: minor
Priority: P2
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: bugzilla digitalmars.com
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.
--
Oct 04 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2392I can't see any way to fix this without dispensing with C style function pointer declarations.Seems very reasonable to remove these to me --
Oct 04 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2392C-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. --
Oct 09 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2392
smjg iname.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |smjg iname.com
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.
--
Nov 24 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2392
Ellery Newcomer <ellery-newcomer utulsa.edu> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |brix brix-verden.dk
13:11:43 PDT ---
*** Issue 3980 has been marked as a duplicate of this issue. ***
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 17 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2392 19:46:40 PST --- 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. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 09 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2392
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
19:53:19 PST ---
http://www.dsource.org/projects/phobos/changeset/2149
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 09 2010









d-bugmail puremagic.com 