Skip to content

Use Q_DECLARE_OPERATORS_FOR_FLAGS in same namespace as flags definition

Having the macro's definition of the operator| in the namespace of the flags argument improves/unbreaks things for the argument-dependent lookup of unqualified function names, e.g. when flags are combined in calls of other methods, but there is some other operator| defined in the namespace of the current code.

Given Q_DECLARE_OPERATORS_FOR_FLAGS creates inlined functions, this should be a source and binary compatible change.

Qt did similar for Qt 5.12 in https://codereview.qt-project.org/c/qt/qtbase/+/225348

Merge request reports