Bug 7073 – Parsing of class-returning varargs function inside module ctor fails
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-12-06T06:47:00Z
Last change time
2015-06-09T05:11:56Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
alex
Comments
Comment #0 by alex — 2011-12-06T06:47:21Z
Code:
class A
{
}
static this()
{
A foo(A[] a ...)
{
return new A();
}
}
Errors:
test.d(7): found 'foo' when expecting ';' following statement
test.d(11): found '}' when expecting ';' following statement
test.d(12): found 'EOF' when expecting '}' following compound statement
Removing the "..." makes it parse correctly.
Comment #1 by alex — 2011-12-06T07:07:37Z
(In reply to comment #0)
> Code:
>
> class A
> {
> }
>
> static this()
> {
> A foo(A[] a ...)
> {
> return new A();
> }
> }
>
> Errors:
>
> test.d(7): found 'foo' when expecting ';' following statement
> test.d(11): found '}' when expecting ';' following statement
> test.d(12): found 'EOF' when expecting '}' following compound statement
>
> Removing the "..." makes it parse correctly.
Also fails with this simpler example:
static this()
{
string f(int[] arr...)
{
}
}