[Issue 4079] New: [CTFE] Stack overflow from undetected circular reference

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 10 16:47:35 PDT 2010


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

           Summary: [CTFE] Stack overflow from undetected circular
                    reference
           Product: D
           Version: future
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-04-10 16:47:33 PDT ---
This is wrong D2 code:

int foo() {
    assert(.r == 0);
    return 0;
}
enum int r = foo();
void main() {}


dmd 2.043 shows a good enough error message (even if there's no need to print
the second error two times):

test.d(2): Error: circular reference to 'r'
test.d(5): Error: cannot evaluate foo() at compile time
test.d(5): Error: cannot evaluate foo() at compile time



This is another wrong D2 program:

int foo() {
    return r;
}
enum int r = foo();
void main() {}


But this time dmd 2.043 shows:
Stack overflow

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


More information about the Digitalmars-d-bugs mailing list