qt6-bb10/tests/auto/tools/moc
Thiago Macieira 44bf5566cb moc: handle nested structs with meta content
We already disallow them for classes; this was a mistake in not handling
the "struct" keyword. The C++ syntax is valid, but moc is unable to
parse two classes at the same time. Users can define the inner outside
of the body of the outer class and that works.

[ChangeLog][moc] Fixed a bug that caused moc to attempt to parse a
nested struct (not class) with meta keywords and this produced code that
wouldn't compile. Nested classes and structures are permitted, but must
be defined outside of the declaration of the outer class.

The fix for this revealed a bug in the presence of Q_DECLARE_FLAGS for
inner classes. This can be easily fixed by moving the token for
Q_DECLARE_FLAGS value outside of the [Q_META_TOKEN_BEGIN,
Q_META_TOKEN_END] range.

[ChangeLog][moc] Fixed a bug that caused moc to reject a class (not
struct) containing Q_DECLARE_FLAGS that was defined inside the body of
an outer class containing Q_OBJECT or Q_GADGET.

Fixes: QTBUG-130498
Pick-to: 6.5
Change-Id: I2a3f148f70280e87302afffd3e7617e5861bb338
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 4e4eef175bc0d0e2a34875ae98f2ddf9eee73b35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-02 02:02:09 +00:00
..
Test.framework/Headers Change license for tests files 2024-02-04 09:56:42 +01:00
subdir Add copyright and licensing to .cpp and .h files missing them 2024-05-28 09:47:01 +02:00
task71021
testproject Change license for tests files 2024-02-04 09:56:42 +01:00
.gitattributes
.gitignore
CMakeLists.txt moc: add a test for Q_FLAG getter/setter on integers 2024-09-24 20:30:14 +00:00
Header
allmocs_baseline_in.json moc: Print method index to JSON output 2024-08-20 08:51:01 +00:00
assign-namespace.h Change license for tests files 2024-02-04 09:56:42 +01:00
backslash-newlines.h Change license for tests files 2024-02-04 09:56:42 +01:00
c-comments.h Change license for tests files 2024-02-04 09:56:42 +01:00
cstyle-enums.h Change license for tests files 2024-02-04 09:56:42 +01:00
cxx-attributes.h Change license for tests files 2024-02-04 09:56:42 +01:00
cxx11-enums.h Change license for tests files 2024-02-04 09:56:42 +01:00
cxx11-explicit-override-control.h Change license for tests files 2024-02-04 09:56:42 +01:00
cxx11-final-classes.h Change license for tests files 2024-02-04 09:56:42 +01:00
cxx11-trailing-return.h Change license for tests files 2024-02-04 09:56:42 +01:00
cxx17-namespaces.h Change license for tests files 2024-02-04 09:56:42 +01:00
dir-in-include-path.h Change license for tests files 2024-02-04 09:56:42 +01:00
dollars.h Change license for tests files 2024-02-04 09:56:42 +01:00
enum_inc.h Add copyright and licensing to .cpp and .h files missing them 2024-05-28 09:47:01 +02:00
enum_with_include.h Change license for tests files 2024-02-04 09:56:42 +01:00
error-on-wrong-notify.h Change license for tests files 2024-02-04 09:56:42 +01:00
escapes-in-string-literals.h Change license for tests files 2024-02-04 09:56:42 +01:00
extraqualification.h Change license for tests files 2024-02-04 09:56:42 +01:00
flags-property-integer-access.h moc: add a test for Q_FLAG getter/setter on integers 2024-09-24 20:30:14 +00:00
forgotten-qinterface.h Change license for tests files 2024-02-04 09:56:42 +01:00
forward-declared-param.h Change license for tests files 2024-02-04 09:56:42 +01:00
forwarddeclaredparam.h Add copyright and licensing to .cpp and .h files missing them 2024-05-28 09:47:01 +02:00
function-with-attributes.h Change license for tests files 2024-02-04 09:56:42 +01:00
fwdclass1.h Change license for tests files 2024-02-04 09:56:42 +01:00
fwdclass2.h Change license for tests files 2024-02-04 09:56:42 +01:00
fwdclass3.h Change license for tests files 2024-02-04 09:56:42 +01:00
gadgetwithnoenums.h Change license for tests files 2024-02-04 09:56:42 +01:00
grand-parent-gadget-class.h Change license for tests files 2024-02-04 09:56:42 +01:00
interface-from-framework.h Change license for tests files 2024-02-04 09:56:42 +01:00
interface-from-include.h Change license for tests files 2024-02-04 09:56:42 +01:00
macro-on-cmdline.h Change license for tests files 2024-02-04 09:56:42 +01:00
moc_include.h Change license for tests files 2024-02-04 09:56:42 +01:00
namespace.h Change license for tests files 2024-02-04 09:56:42 +01:00
namespace_no_merge.h Change license for tests files 2024-02-04 09:56:42 +01:00
namespaced-base-class.h Change license for tests files 2024-02-04 09:56:42 +01:00
namespaced-flags.h Change license for tests files 2024-02-04 09:56:42 +01:00
no-keywords.h Change license for tests files 2024-02-04 09:56:42 +01:00
non-gadget-parent-class.h Change license for tests files 2024-02-04 09:56:42 +01:00
oldstyle-casts.h Change license for tests files 2024-02-04 09:56:42 +01:00
os9-newlines.h Add REUSE ignore comment 2024-05-08 11:09:28 +00:00
parse-boost.h Change license for tests files 2024-02-04 09:56:42 +01:00
parse-defines.h Change license for tests files 2024-02-04 09:56:42 +01:00
plugin_metadata.h Change license for tests files 2024-02-04 09:56:42 +01:00
pointery_to_incomplete.h Change license for tests files 2024-02-04 09:56:42 +01:00
pp-dollar-signs.h Change license for tests files 2024-02-04 09:56:42 +01:00
pure-virtual-signals.h Change license for tests files 2024-02-04 09:56:42 +01:00
qinvokable.h Change license for tests files 2024-02-04 09:56:42 +01:00
qmlmacro.h Change license for tests files 2024-02-04 09:56:42 +01:00
qprivateslots.h Change license for tests files 2024-02-04 09:56:42 +01:00
qtbug-35657-gadget.h Change license for tests files 2024-02-04 09:56:42 +01:00
related-metaobjects-in-gadget.h Change license for tests files 2024-02-04 09:56:42 +01:00
related-metaobjects-in-namespaces.h Change license for tests files 2024-02-04 09:56:42 +01:00
related-metaobjects-name-conflict.h Change license for tests files 2024-02-04 09:56:42 +01:00
signal-with-default-arg.h Change license for tests files 2024-02-04 09:56:42 +01:00
single-quote-digit-separator-n3781.h Change license for tests files 2024-02-04 09:56:42 +01:00
single_function_keyword.h tst_moc: fix 'inline function used but never defined' GCC warning 2024-06-18 08:09:09 +00:00
slots-with-void-template.h Change license for tests files 2024-02-04 09:56:42 +01:00
task87883.h Change license for tests files 2024-02-04 09:56:42 +01:00
task192552.h Change license for tests files 2024-02-04 09:56:42 +01:00
task234909.h Change license for tests files 2024-02-04 09:56:42 +01:00
task240368.h Change license for tests files 2024-02-04 09:56:42 +01:00
tech-preview.h Long live QT_TECH_PREVIEW_API 2024-02-20 05:01:09 +01:00
template-gtgt.h Change license for tests files 2024-02-04 09:56:42 +01:00
trigraphs.h Change license for tests files 2024-02-04 09:56:42 +01:00
tst_moc.cpp moc: handle nested structs with meta content 2024-11-02 02:02:09 +00:00
unterminated-function-macro.h Change license for tests files 2024-02-04 09:56:42 +01:00
using-namespaces.h Change license for tests files 2024-02-04 09:56:42 +01:00
warn-on-multiple-qobject-subclasses.h Change license for tests files 2024-02-04 09:56:42 +01:00
warn-on-property-without-read.h Change license for tests files 2024-02-04 09:56:42 +01:00
win-newlines.h Change license for tests files 2024-02-04 09:56:42 +01:00