Thread overview | |||||
---|---|---|---|---|---|
|
April 09, 2011 [Issue 5826] New: Error: Statement SwitchErrorStatement::toCBuffer() cannot be interpreted at compile time | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=5826 Summary: Error: Statement SwitchErrorStatement::toCBuffer() cannot be interpreted at compile time Product: D Version: D1 & D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: ibuclaw@ubuntu.com --- Comment #0 from Iain Buclaw <ibuclaw@ubuntu.com> 2011-04-09 12:20:08 PDT --- From fail_compilation/fail146.d: int bar(int i) { switch (i) { case 1: i = 4; break; case 8: i = 3; break; } return i; } void main() { static b = bar(7); printf("b = %d, %d\n", b, bar(7)); assert(b == 3); } Error message: fail_compilation/fail146.d(4): Error: no default or case for 7 in switch statement fail_compilation/fail146.d(4): Error: Statement SwitchErrorStatement::toCBuffer() cannot be interpreted at compile time fail_compilation/fail146.d(18): Error: cannot evaluate bar(7) at compile time fail_compilation/fail146.d(18): Error: cannot evaluate bar(7) at compile time fail_compilation/fail146.d(19): Error: 'printf' is not defined, perhaps you need to import core.stdc.stdio; ? For all intent and purposes, this line: fail_compilation/fail146.d(4): Error: Statement SwitchErrorStatement::toCBuffer() cannot be interpreted at compile time Should ideally not be emitted as an error. Regards -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 29, 2012 [Issue 5826] Error: Statement SwitchErrorStatement::toCBuffer() cannot be interpreted at compile time | ||||
---|---|---|---|---|
| ||||
Posted in reply to Iain Buclaw | http://d.puremagic.com/issues/show_bug.cgi?id=5826 Iain Buclaw <ibuclaw@ubuntu.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #1 from Iain Buclaw <ibuclaw@ubuntu.com> 2012-08-29 12:46:22 PDT --- (In reply to comment #0) > From fail_compilation/fail146.d: > > int bar(int i) > { > switch (i) > { > case 1: > i = 4; > break; > case 8: > i = 3; > break; > } > return i; > } > > void main() > { > static b = bar(7); > printf("b = %d, %d\n", b, bar(7)); > assert(b == 3); > } > > > > Error message: > fail_compilation/fail146.d(4): Error: no default or case for 7 in switch > statement > fail_compilation/fail146.d(4): Error: Statement > SwitchErrorStatement::toCBuffer() > cannot be interpreted at compile time > fail_compilation/fail146.d(18): Error: cannot evaluate bar(7) at compile time > fail_compilation/fail146.d(18): Error: cannot evaluate bar(7) at compile time > fail_compilation/fail146.d(19): Error: 'printf' is not defined, perhaps you > need to import core.stdc.stdio; ? > > > For all intent and purposes, this line: > > fail_compilation/fail146.d(4): Error: Statement > SwitchErrorStatement::toCBuffer() cannot be interpreted at compile time > > Should ideally not be emitted as an error. > > Regards Error message is now: test.d:3: Error: non-final switch statement without a default is deprecated test.d:17: Error: CTFE failed because of previous errors in bar test.d:18: Error: 'printf' is not defined, perhaps you need to import core.stdc.stdio; ? Interestingly, fail146.d has been removed from the testsuite, why is this? Marking as resolved anyway... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 30, 2012 [Issue 5826] Error: Statement SwitchErrorStatement::toCBuffer() cannot be interpreted at compile time | ||||
---|---|---|---|---|
| ||||
Posted in reply to Iain Buclaw | http://d.puremagic.com/issues/show_bug.cgi?id=5826 Brad Roberts <braddr@puremagic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |braddr@puremagic.com --- Comment #2 from Brad Roberts <braddr@puremagic.com> 2012-08-30 15:39:17 PDT --- I was curious, so I went to find the reason: https://github.com/D-Programming-Language/dmd/commit/d530bf60e34bb01932d5656c6a1b392beac6e5d2 Found via looking at the history for the file: https://github.com/D-Programming-Language/dmd/commits/master/test/fail_compilation/fail146.d also doable through the git cli: git log test/fail_compilation/fail146.d -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation