Thread overview
[Issue 7073] New: Parsing of class-returning varargs function inside module ctor fails
Jan 02, 2012
Kenji Hara
Jan 05, 2012
Walter Bright
December 06, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7073

           Summary: Parsing of class-returning varargs function inside
                    module ctor fails
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: xtzgzorex@gmail.com


--- Comment #0 from Alex Rønne Petersen <xtzgzorex@gmail.com> 2011-12-06 06:47:21 PST ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 06, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7073



--- Comment #1 from Alex Rønne Petersen <xtzgzorex@gmail.com> 2011-12-06 07:07:37 PST ---
(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...)
    {
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7073


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch, rejects-valid


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2012-01-02 04:14:50 PST ---
D2 patch: https://github.com/D-Programming-Language/dmd/pull/601

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7073


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2012-01-05 12:33:12 PST ---
https://github.com/D-Programming-Language/dmd/commit/74520a3de533c12f484ee1e8329f492beaa3fba4

https://github.com/D-Programming-Language/dmd/commit/9524e90d3640ab1467b1e2534bb1a2e5f152f627

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------