On this page

Unreachable code

This warning category is spelled [unreachable-code] by qmllint.

Unreachable code

What happened?

Instructions in your code are unreachable and will never be executed.

Why is that bad?

Unreachable code does not contribute to the program logic and bloats the disk and memory footprint of the application. Unreachable code can be a sign of underlying bugs or logic errors.

Example

function f(b: bool) : string {
    if (b)
        return "true"
    else
        return "false"
    return "something else??" // unreachable statement
}

To fix this warning, remove the dead instructions or refactor your code to make all logic reachable.

function f(b: bool) : string {
    if (b)
        return "true"
    else
        return "false"
}

© 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.