Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
Qt Creator 4.7.0, Qt Creator 4.8.0-beta1
-
None
Description
When using symbols from namespace A in namespace B, the symbol toolbar is populated with wrong and repetitive items, and it does not show anymore the current method. The issue can be reproduced with the following code:
#include <QCoreApplication> typedef int ERRCODE; #define MYRC_OK 0 namespace Other { class MyClass { }; } namespace Main { template <class X, class Y, class Z> class TemplateA { public: explicit TemplateA(); }; template< class X, class Y, class Z > TemplateA< X, Y, Z >::TemplateA() { } template< class X, class Y > class TemplateB : public TemplateA< X, Y, TemplateB< X, Y > > { public: explicit TemplateB(); ERRCODE method(Other::MyClass& ); }; template< class X, class Y > TemplateB< X, Y >::TemplateB() { } template < class X, class Y > ERRCODE TemplateB< X, Y >::method(Other::MyClass& ) { ERRCODE ret = MYRC_OK; return ret; } #define DEFINE_SPECIALIZED_METHOD(ValueType) \ template <> \ ERRCODE TemplateB< X, ValueType >::method(MyClass &) \ { \ ERRCODE rc = MYRC_OK \ if (rc != MYRC_OK) \ return rc; \ return MYRC_OK; \ } template < class X, class Y > struct TemplateC; #define DEFINE_OTHER_METHODS(ValueType) \ template <> \ void TemplateB< X, ValueType >::init(bool) \ { \ } #ifdef MY_DEF DEFINE_SPECIALIZED_METHOD(Other::MyClass) DEFINE_OTHER_METHODS(Other::MyClass) #endif #undef DEFINE_SPECIALIZED_METHOD #ifdef MY_OTHER_DEF template <> ERRCODE TemplateB< int, float >::method(MyClass &) { return MYRC_OK; } #endif } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); return a.exec(); }
After the parsing, the toolbar is populated with wrong items, and if you place the cursor inside a method (example, the constructor of TemplateA), the MYRC_OK constant is displayed.
This is a follow-up of the analysis of the issue reported here: QTCREATORBUG-20917 . Even when using the current 4.7 HEAD (i.e. that includes the fix for the bug reported in the link), the issue happens.
Attachments
Issue Links
- relates to
-
QTCREATORBUG-20917 Clang Code Model separate template definition failure
- Closed