Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
October 20, 2012 [Issue 8857] New: [CTFE] Referring to a wrong member of a sruct in CTFE with -inline | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=8857 Summary: [CTFE] Referring to a wrong member of a sruct in CTFE with -inline Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: youxkei@gmail.com --- Comment #0 from Hisayuki Mima <youxkei@gmail.com> 2012-10-20 23:27:56 JST --- Code: struct Result{ bool match; string next; } void func1()(){ auto r = func2(); if(r.match){ // line 5 auto next = r.next; } } Result func2(){ Result result; result.match = true; return result; } static assert({ func1(); return true; }()); void main(){} Compilation Output: bug.d(5): Error: Result(true,null).next does not evaluate to a boolean. The above code doesn't compiled by dmd 2.060 with -inline. At the line 5, I surely wrote "r.match", but dmd seems to have recognized "r.match" as "r.next". This means that dmd is referring to a wrong member of the struct "Result". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 06, 2012 [Issue 8857] [CTFE] does not evaluate to a boolean, only with -inline | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hisayuki Mima | http://d.puremagic.com/issues/show_bug.cgi?id=8857 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[CTFE] Referring to a wrong |[CTFE] does not evaluate to |member of a sruct in CTFE |a boolean, only with |with -inline |-inline --- Comment #1 from Don <clugdbug@yahoo.com.au> 2012-11-06 11:46:53 PST --- Original title: [CTFE] Referring to a wrong member of a struct in CTFE with -inline Actually it isn't using a wrong struct member. What happens is that the inliner changes if(r.match){ // line 5 auto next = r.next; } into: r.match && (string next = r.next); The CTFE engine cannot currently cope with this expression, and gives an error. It's the wrong line number, though this hardly matters since it's really an internal compiler error. It's quite an obscure bug, in that it is only triggered with -inline (the code after inlining is not valid D code) + a true condition + an assignment where the value is null. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 10, 2012 [Issue 8857] [CTFE] does not evaluate to a boolean, only with -inline | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hisayuki Mima | http://d.puremagic.com/issues/show_bug.cgi?id=8857 --- Comment #2 from github-bugzilla@puremagic.com 2012-11-10 12:14:56 PST --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/517c80e609208e38b36be621642d8c8032038971 Fix issue 8857 [CTFE] does not evaluate to a boolean, only with -inline This is a situation where we've evaluated an Lvalue, but we actually need an Rvalue. The bug report is one of the few circumstances where it matters. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 10, 2012 [Issue 8857] [CTFE] does not evaluate to a boolean, only with -inline | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hisayuki Mima | http://d.puremagic.com/issues/show_bug.cgi?id=8857 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Version|D2 |D1 & D2 Resolution| |FIXED -- 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