Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
February 22, 2006 static assert fouls up template promotion when between static if statements. | ||||
---|---|---|---|---|
| ||||
If you uncomment the indicated line, it won't compile. (The fact that the others will compile is a really nice feature from DMD 0.146). Note that a failed template promotion can easily send the compiler into an error message orgy, which you unfortunately can't break out of with ^C. template cat() { static assert(1); // OK static if (1) { // static assert(1); // doesn't work static if (1) { static assert(1); // OK const int cat = 3; } } } void main() { const int a = cat!(); } |
February 22, 2006 Re: static assert fouls up template promotion when between static if statements. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston | Don Clugston wrote:
> If you uncomment the indicated line, it won't compile.
> (The fact that the others will compile is a really nice feature from DMD 0.146).
They will? Awesome! I hadn't checked this recently.
Sean
|
February 23, 2006 Re: static assert fouls up template promotion when between static if | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston | In article <dthlsr$1t9a$1@digitaldaemon.com>, Don Clugston says... > >Note that a failed template promotion can easily send the compiler into an error message orgy, which you unfortunately can't break out of with ^C. If you're on linux, try compiling with eg. "make | head". Sorta OT, but I think the error message orgy itself should be treated as a bug. If the compiler fails to instantiate a template, it continues to compile the entire program but fails with _every_ template. This leads to tons of unrelated and bogus error messages like "template instance cannot resolve forward reference". Nick |
February 24, 2006 Re: static assert fouls up template promotion when between static if statements. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston Attachments: | Don Clugston schrieb am 2006-02-22: > If you uncomment the indicated line, it won't compile. > (The fact that the others will compile is a really nice feature from DMD > 0.146). > Note that a failed template promotion can easily send the compiler into > an error message orgy, which you unfortunately can't break out of with ^C. > > template cat() > { > static assert(1); // OK > static if (1) { > // static assert(1); // doesn't work > static if (1) { > static assert(1); // OK > const int cat = 3; > } > } > } > > void main() { > const int a = cat!(); > } Added to DStress as http://dstress.kuehne.cn/compile/a/assert_14_A.d http://dstress.kuehne.cn/nocompile/a/assert_14_B.d http://dstress.kuehne.cn/nocompile/a/assert_14_C.d http://dstress.kuehne.cn/compile/a/assert_14_D.d http://dstress.kuehne.cn/compile/a/assert_14_E.d http://dstress.kuehne.cn/nocompile/a/assert_14_F.d http://dstress.kuehne.cn/compile/a/assert_14_G.d http://dstress.kuehne.cn/nocompile/a/assert_14_H.d http://dstress.kuehne.cn/nocompile/a/assert_14_I.d http://dstress.kuehne.cn/compile/a/assert_14_J.d Thomas |
Copyright © 1999-2021 by the D Language Foundation