Parsing bug?
RazvanN
razvan.nitu1305 at gmail.com
Tue Apr 28 07:41:28 UTC 2020
On Monday, 27 April 2020 at 22:48:46 UTC, Jean-Louis Leroy wrote:
> import std.traits;
>
> unittest
> {
> struct attr;
> void foo() {}
> ReturnType!foo bar(int a) {}
> void baz(@attr int a) {}
> ReturnType!foo blah(@attr int a) {}
> }
>
> dmd -c -unittest bug.d
> bug.d(9): Error: found `blah` when expecting `;` following
> statement
> bug.d(10): Error: found `}` when expecting `;` following
> statement
> bug.d(11): Error: found `End of File` when expecting `}`
> following compound statement
>
> This goes away if I remove `unittest { }`.
Yes, this is a parser bug. `unittest` isn't important here (you
can replace unittest with a function declaration and the behavior
will be the same), it's the fact that you are declaring a nested
function which returns a template instance that confuses the
parser. Please file this on bugzilla.
More information about the Digitalmars-d
mailing list