https://bugs.kde.org/show_bug.cgi?id=366693

            Bug ID: 366693
           Summary: Classes with Q_OBJECT macro are not parsed correctly
           Product: kdevelop
           Version: 4.7.3
          Platform: Gentoo Packages
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: Language Support: CPP
          Assignee: [email protected]
          Reporter: [email protected]

If a C++ class is defined with Q_OBJECT macro then editor show a syntax error:

class Foo: public QObject {
    Q_OBJECT
_p_ublic:  // <-- red underscore is shown under the "p" letter
...
}

As shown above the error is indicated at the 'public' keyword.  The tooltip
says:

Problem in Parser:
Unexpected token 'public'

As the result the class members are not recognized (autocompletion does not
work).  When Q_OBJECT macro is removed from the source the syntax error
disappears.

The Q_OBJECT macro itself is recognized correctly.  The tooltip shows that it
is defined in /usr/include/qt5/QtCore/qobjectdefs.h :187 and following
preprocessed body:

------------------------------------------
public:  template <typename ThisObject> inline void
qt_check_for_QOBJECT_macro(const ThisObject& _q_argument) const  { int i =
qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; }   _Pragma("GCC
diagnostic push")      static const QMetaObject staticMetaObject;  virtual
const QMetaObject* metaObject() const;  virtual void* qt_metacast(const char*);
 virtual int qt_metacall(QMetaObject::Call, int, void**);  static inline
QString tr(const char* s, const char* c = nullptr , int n = -1)  { return
staticMetaObject.tr(s, c, n); }   static inline QString trUtf8(const char* s,
const char* c = nullptr , int n = -1)  { return staticMetaObject.tr(s, c, n); }
  private:    __attribute__((visibility("hidden")))   static void
qt_static_metacall(QObject*, QMetaObject::Call, int, void**);  _Pragma("GCC
diagnostic pop")    struct QPrivateSignal {};
------------------------------------------

With Qt4 it is working correctly.  It was also working correctly with Qt 5.5. 
The problem appeared after upgrade to Qt 5.6.1.

I have kdevplatform 1.7.3.  Using CMake build system with GCC in the project.

Reproducible: Always

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to