diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 73899199..28c7a43c 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -305,10 +305,9 @@ bool Moc::parseEnum(EnumDef *def) return IncludeState::NoInclude; }; do { + handleInclude(); if (lookup() == RBRACE) // accept trailing comma break; - if ( handleInclude() == IncludeState::IncludeEnd) - continue; next(IDENTIFIER); def->values += lexem(); handleInclude(); diff --git a/tests/auto/tools/moc/enum_with_include.h b/tests/auto/tools/moc/enum_with_include.h index b8abf77f..cd53ba6a 100644 --- a/tests/auto/tools/moc/enum_with_include.h +++ b/tests/auto/tools/moc/enum_with_include.h @@ -34,6 +34,11 @@ class Foo : public QObject { enum en { #include }; + + enum class en2 { + #include + reference = 42 + }; Q_OBJECT }; #endif