Bug 6999 – parsing error for inout method/ wrong headergen
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2011-11-23T18:14:00Z
Last change time
2012-07-14T07:18:37Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2011-11-23T18:14:40Z
struct S
{
inout(int) foo() inout
{
return a;
}
int a;
}
---
// D import file generated from 'bug3.d'
struct S
{
inout inout(int) foo()
{
return a;
}
int a;
}
---
Compiling a method with 'inout inout(int) ident()'
will cause the following error.
Error: inout on return means inout must be on a parameter as well for inout(int)()
It seems that the language requires the method attribute to follow
the parameter list.
http://www.d-programming-language.org/declaration.html#DeclaratorSuffix
But the header gen will output the inout in front of the return type.
The error message should be better in any case.
Probably related bug:
http://d.puremagic.com/issues/show_bug.cgi?id=6872