http://d.puremagic.com/issues/show_bug.cgi?id=5453

           Summary: ICE(statement.c): array literal involving forward
                    referenced struct
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don <clugd...@yahoo.com.au> 2011-01-14 00:17:27 PST ---
Reported by %u.
------------
struct S
{    
  static int func() {
    S s;
    int e;
    switch( e )
    {  default: return 0;
    }
  }    
  static int[1] ARR = [func() ];
}
----
Assertion failure: '!cases' on line 2741 in file 'statement.c'

abnormal program termination


It's happening because the CTFE for ARR speculatively runs func().
There's a 'no size yet for forward referenced struct' error because S isn't
complete yet. But this happens with errors gagged.
The SwitchStatement completes its semantic pass correctly. 
But, because "S s;" failed, semantic gets run again for func(), without errors
gagged this time. SwitchStatement::semantic() detects it's been run twice, and
asserts.

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

Reply via email to