[Issue 5906] Just pre-conditions at compile-time when arguments are static

2013-03-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5906 yebblies yebbl...@gmail.com changed: What|Removed |Added CC||yebbl...@gmail.com ---

[Issue 5906] Just pre-conditions at compile-time when arguments are static

2013-03-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5906 --- Comment #8 from bearophile_h...@eml.cc 2013-03-07 12:15:52 PST --- (In reply to comment #7) This can be done by converting precondition bodies to expressions then const-folding them. Non-trivial, but possible. Thank you for the note,

[Issue 5906] Just pre-conditions at compile-time when arguments are static

2013-03-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5906 --- Comment #9 from yebblies yebbl...@gmail.com 2013-03-08 13:33:42 EST --- (In reply to comment #8) (In reply to comment #7) This can be done by converting precondition bodies to expressions then const-folding them. Non-trivial, but

[Issue 5906] Just pre-conditions at compile-time when arguments are static

2013-03-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5906 --- Comment #11 from bearophile_h...@eml.cc 2013-03-07 19:29:40 PST --- (In reply to comment #10) If the pre-condition analysis (constant folding) is done after a normal step of dead branch removal, then maybe that error will not be shown.

[Issue 5906] Just pre-conditions at compile-time when arguments are static

2013-03-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5906 --- Comment #10 from bearophile_h...@eml.cc 2013-03-07 19:25:12 PST --- (In reply to comment #9) struct S(int a) { void fun(int b) in { assert(a != b); } body {} } void main() { foreach(i; TypeTuple!(1, 2, 3, 4)) {

[Issue 5906] Just pre-conditions at compile-time when arguments are static

2013-03-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5906 --- Comment #12 from yebblies yebbl...@gmail.com 2013-03-08 14:33:58 EST --- (In reply to comment #10) I see, thank you for the answer. If the pre-condition analysis (constant folding) is done after a normal step of dead branch removal,

[Issue 5906] Just pre-conditions at compile-time when arguments are static

2013-02-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5906 --- Comment #6 from bearophile_h...@eml.cc 2013-02-27 15:56:31 PST --- (In reply to comment #4) But if I write code like this: void main(string[] args) { byte x = args.length; } It does not perform that test at compile-time,

[Issue 5906] Just pre-conditions at compile-time when arguments are static

2012-12-25 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5906 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added CC|

[Issue 5906] Just pre-conditions at compile-time when arguments are static

2012-12-25 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5906 bearophile_h...@eml.cc changed: What|Removed |Added Status|NEW |RESOLVED Resolution|

[Issue 5906] Just pre-conditions at compile-time when arguments are static

2012-12-25 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5906 --- Comment #4 from bearophile_h...@eml.cc 2012-12-25 03:42:02 PST --- If I write: void main() { byte x = 200; } The compiler refuses that code statically, it means it performs a run-time test of the value: test.d(2): Error: cannot

[Issue 5906] Just pre-conditions at compile-time when arguments are static

2012-12-25 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5906 --- Comment #5 from bearophile_h...@eml.cc 2012-12-25 03:42:49 PST --- (In reply to comment #4) The compiler refuses that code statically, it means it performs a run-time test of the value: Sorry, I meant a compile-time test. --