Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
6.x
-
None
-
-
5494f0af323a42390f9375c75e9298290ecb7662 (qt/qtbase/dev) 35b2e74fd77d912cdd7efed379b648609a95d4b5 (qt/qtbase/6.0)
Description
Tested against dev as of Nov 30th, with gcc-9 and gcc-10 on Debian/sid
Prerequisite:
- you have a namespaced Qt, e.g. one like the CI uses: -qtnamespace TestNamespace
- you have an enum or struct within another, custom namespace in your app
- you have QDebug operator<<(QDebug dbg, <foo>) defined for your types
If you then want to Q_DECLARE_METATYPE on this struct or enum, you have to now put the QDebug streaming operator inside a QT_BEGIN|END_NAMESPACE. This was a) not needed in Qt 5 times, b) is not mentioned in the docs and c) is quite awkward for customer code.
Interestingly, a pointer-to-struct still works fine, even with the streaming operator defined in the root namespace.
See attached example: it does not compile out of the box, but it works fine if you #define WORKAROUND=1