Ok. Here's a version to work with, if anyone wants to reproduce the behavior.

import std.stdio;

void main() {
        auto sub = new BaseSub();
        sub.doSomething();
}

class Base {
        SomeStruct someStruct;
        this() {
                
        }
        
        public void doSomething() {
                writeln("On strike today");
        }
}

class BaseSub : Base {
        this () {
                super();
        }
        
        override {
                public void doSomething() {
auto someStruct = checkSomething("input"); // Bug here. Remove auto and "Same here" will be printed.
                        doSomethingElse();
                }
        }
        
        private void doSomethingElse() {
                if (someStruct.equal) {
                        writeln("Same here!");
                }
        }
        
        private auto checkSomething(string s) {
                return SomeStruct(s);
        }
}

struct SomeStruct {
        private:
        string str;
        bool isEqual;
        this(string s) {
                str = s;
                checkInput();
        }
        
        private void checkInput() {
                if (str == "input") {
                        isEqual = true;
                }
        }
        
        @property bool equal() {
                return isEqual;
        }
}

Reply via email to