On this page

Confusing expression statement

This warning category is spelled [confusing-expression-statement] by qmllint.

Expression statement has no obvious effect

What happened?

You used an expression statement that has no obvious effect.

Why is that bad?

It makes the code more difficult to read and may cause confusion. Usually, it indicates that some expression result was ignored.

The expression statement is compiled into bytecode and evaluated at runtime, despite not having any effect.

Example

import QtQuick

Item {
    function add(a: int, b: int) : int {
        a + b
    }
}

To fix this warning, remove the expression without effect or use the expression result.

import QtQuick

Item {
    function add(a: int, b: int) : int {
        return a + b
    }
}

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.