Thread overview
[Issue 9806] New: assertion failure in struct.c:668
Mar 24, 2013
Nils
Apr 01, 2013
Kenji Hara
Apr 01, 2013
Nils
Apr 02, 2013
Kenji Hara
Apr 02, 2013
Nils
Apr 02, 2013
Kenji Hara
Apr 02, 2013
Nils
Apr 02, 2013
Walter Bright
March 24, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9806

           Summary: assertion failure in struct.c:668
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: ice
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: nilsbossung@googlemail.com


--- Comment #0 from Nils <nilsbossung@googlemail.com> 2013-03-24 04:20:54 PDT ---
Fails with v2.063-devel-618d827.
Compiles with v2.062.

---
cat > test.d <<code
struct S(alias x)
{
    alias S!0 N;
}
enum expr = 0 * 0;
alias S!expr T;
code
dmd -c -o- test.d
---
dmd: struct.c:668: virtual void StructDeclaration::semantic(Scope*): Assertion
`type->ty != Tstruct || ((TypeStruct *)type)->sym == this' failed.
Aborted (core dumped)
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 01, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9806


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-04-01 08:34:15 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1822

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 01, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9806



--- Comment #2 from Nils <nilsbossung@googlemail.com> 2013-04-01 12:38:59 PDT ---
This slight variation still fails:

---
cat > test.d <<code
struct S(alias x)
{
    template Next()
    {
        enum expr = x + 1;
        alias S!expr Next;
    }
}
alias S!1 One;
alias S!0.Next!() OneAgain;
code
dmd -c -o- test.d
---
dmd: struct.c:722: virtual void StructDeclaration::semantic(Scope*): Assertion
`type->ty != Tstruct || ((TypeStruct *)type)->sym == this' failed.
Aborted (core dumped)
---

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



--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2013-04-01 18:15:12 PDT ---
(In reply to comment #2)
> This slight variation still fails:
> 
> ---
> cat > test.d <<code
> struct S(alias x)
> {
>     template Next()
>     {
>         enum expr = x + 1;
>         alias S!expr Next;
>     }
> }
> alias S!1 One;
> alias S!0.Next!() OneAgain;
> code
> dmd -c -o- test.d
> ---
> dmd: struct.c:722: virtual void StructDeclaration::semantic(Scope*): Assertion
> `type->ty != Tstruct || ((TypeStruct *)type)->sym == this' failed.
> Aborted (core dumped)
> ---

I updated my pull request to fix it.

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



--- Comment #4 from Nils <nilsbossung@googlemail.com> 2013-04-02 02:37:39 PDT ---
Still fails with a tuple parameter:

---
cat > test.d <<code
struct S(x ...)
{
    template Next()
    {
        enum expr = x[0] + 1;
        alias S!expr Next;
    }
}
alias S!1 One;
alias S!0.Next!() OneAgain;
code
dmd -c -o- test.d
---
dmd: struct.c:722: virtual void StructDeclaration::semantic(Scope*): Assertion
`type->ty != Tstruct || ((TypeStruct *)type)->sym == this' failed.
Aborted (core dumped)
---

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



--- Comment #5 from Kenji Hara <k.hara.pg@gmail.com> 2013-04-02 04:23:49 PDT ---
(In reply to comment #4)
> Still fails with a tuple parameter:
[snip]

Updated. Thanks to good test cases.

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



--- Comment #6 from Nils <nilsbossung@googlemail.com> 2013-04-02 04:59:36 PDT ---
Alright, my code compiles again. You're the man, Kenji.

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



--- Comment #7 from github-bugzilla@puremagic.com 2013-04-02 14:04:28 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/2cbe9b1b389f3617e70ffbdbe20f6b30aeac9d10 fix Issue 9806 - assertion failure in struct.c:668

- Save Scope object to resolve forward references
- Do constant folding in template value argument comparison

Additional:
Add assertions to check AST identity in `ClassDeclaration::semantic` and
`InterfaceDeclaration::semantic`.

https://github.com/D-Programming-Language/dmd/commit/ca458073b3bdb0a0bc768e4eb062fb533eaac995 Merge pull request #1822 from 9rnsr/fix9806

[REG2.063a] Issue 9806 - assertion failure in struct.c:668

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


Walter Bright <bugzilla@digitalmars.com> changed:

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


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