p.s. changing the line a.valueChanged.connect!"watch"(o); to a.valueChangedSg.connect!"watch"(o); (i.e. bypassing method call) works as expected both with -O0 and -O2.