Comment #0 by kamm-removethis — 2007-06-19T07:49:06Z
This fails to compile
class Foo
{
int x;
invariant invariant(int)* geti() // line 6
{ return &x; }
const const(int)* getc() // line 12
{ return &x;
} // line 15
}
with the errors
invartest.d(6): Declaration expected, not '('
invartest.d(12): Declaration expected, not '('
invartest.d(15): unrecognized declaration.
Putting the return types into aliases fixes the problem:
alias invariant(int)* RT_I;
invariant RT_I geti() {...}
alias const(int)* RT_C;
const RT_C getc() {...}
compiles.
Comment #1 by jarrett.billingsley — 2007-06-19T14:09:48Z
*** Bug 1281 has been marked as a duplicate of this bug. ***
Comment #2 by bruno.do.medeiros+deebugz — 2007-06-22T17:17:28Z
Nor even variables declared at module scope:
---- ----
module mod;
invariant(char)[] p;
----
mod.d(2): Declaration expected, not '('
Comment #3 by kamm-removethis — 2007-06-27T14:47:38Z