Thread overview | ||||||
---|---|---|---|---|---|---|
|
September 06, 2010 [Issue 4828] New: ICE w/ non-boolean dot expression sth.template_instance in static if | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4828 Summary: ICE w/ non-boolean dot expression sth.template_instance in static if Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: ice-on-invalid-code Severity: regression Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: rsinfu@gmail.com --- Comment #0 from Shin Fujishiro <rsinfu@gmail.com> 2010-09-05 23:25:53 PDT --- Using an syntax `something.template_instance` in static-if triggers an assertion at expression.c(817). -------------------- struct S { template P() {} alias P!() p; } static if (S.p) {} // ICE -------------------- % dmd -o- -c test Assertion failed: (pr != PREC_zero), function expToCBuffer, file expression.c, line 817. -------------------- Assertion failure did not occur before svn r629. -------------------- % dmd-r628 -o- -c test test.d(6): Error: expression S dotexp P!() is not constant or does not evaluate to a bool -------------------- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 06, 2010 [Issue 4828] ICE w/ non-boolean dot expression sth.template_instance in static if | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shin Fujishiro | http://d.puremagic.com/issues/show_bug.cgi?id=4828 --- Comment #1 from Shin Fujishiro <rsinfu@gmail.com> 2010-09-05 23:28:59 PDT --- Created an attachment (id=748) Patch against dmd r660, implements DotExp::toCBuffer() The attached patch implements DotExp::toCBuffer(). The syntax `something.template_instance` yields a DotExp. The repro code in comment #0 is invalid, and the compiler tries to generate an error message. Then it calls toCBuffer() on the DotExp object, but it's not overridden, so the base class' BinExp::toCBuffer() is invoked. It hits the assertion because `precedence[TOKdotexp]` is PREC_zero: -------------------- void BinExp::toCBuffer(OutBuffer *buf, HdrGenState *hgs) { expToCBuffer(buf, hgs, e1, precedence[op]); // op == TOKdotexp ... -------------------- So, DotExp::toCBuffer() needs to be implemented to handle this case. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 06, 2010 [Issue 4828] ICE w/ non-boolean dot expression sth.template_instance in static if | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shin Fujishiro | http://d.puremagic.com/issues/show_bug.cgi?id=4828 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug@yahoo.com.au --- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-09-06 04:19:52 PDT --- Another regression from the same svn commit, that hits the same assert: static assert(!is(typeof(Object.tupleof[2000]=0))); --- precedence not defined for token 'tuple' assert expression.c(816) precedence[e->op] != PREC_zero -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 11, 2010 [Issue 4828] ICE w/ non-boolean dot expression sth.template_instance in static if | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shin Fujishiro | http://d.puremagic.com/issues/show_bug.cgi?id=4828 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED --- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2010-09-11 13:22:37 PDT --- http://www.dsource.org/projects/dmd/changeset/669 -- 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