[Issue 5826] Error: Statement SwitchErrorStatement::toCBuffer() cannot be interpreted at compile time
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Aug 29 12:46:26 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5826
Iain Buclaw <ibuclaw at ubuntu.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #1 from Iain Buclaw <ibuclaw at 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: -------
More information about the Digitalmars-d-bugs
mailing list