Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.3.2
-
Ubuntu 13.04
Description
Following code randomly prints fail even if f() returns 0 or 1.
import QtQuick 2.0 Rectangle { width: 180 height: 100 Timer { running: true repeat: true interval: 100 onTriggered: { r(); } } function f() { return Math.random() >= 0.5 ? 1 : 0; } function r() { switch (f()) { case 0: case 1: print("0 or 1") return; default: console.log("fail") } } }
Attachments
For Gerrit Dashboard: QTBUG-41630 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
108049,4 | Don't evaluate the expression in switch() multiple times | 5.5 | qt/qtdeclarative | Status: MERGED | +2 | 0 |