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

--- Comment #0 from Hisayuki Mima <> 2012-10-20 23:27:56 JST 

struct Result{ bool match; string next; }

void func1()(){
    auto r = func2();
    if(r.match){ // line 5
        auto next =;

Result func2(){
    Result result;
    result.match = true;
    return result;

static assert({
    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 "".
This means that dmd is referring to a wrong member of the struct "Result".

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to