[Issue 8857] New: [CTFE] Referring to a wrong member of a sruct in CTFE with -inline
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Oct 20 07:28:04 PDT 2012
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 at puremagic.com
ReportedBy: youxkei at gmail.com
--- Comment #0 from Hisayuki Mima <youxkei at 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: -------
More information about the Digitalmars-d-bugs
mailing list