This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 238478 - plugin C/C++ Intellisense - incorrect parse of class template
Summary: plugin C/C++ Intellisense - incorrect parse of class template
Status: RESOLVED WORKSFORME
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Completion (show other bugs)
Version: 7.4
Hardware: PC Windows 8 x64
: P2 normal (vote)
Assignee: petrk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-17 15:01 UTC by reg3f
Modified: 2013-11-26 14:57 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
screencast for test code (1.72 MB, application/octet-stream)
2013-11-17 15:01 UTC, reg3f
Details
No Suggestions (11.15 KB, image/png)
2013-11-17 15:03 UTC, reg3f
Details
option not available (8.91 KB, image/png)
2013-11-17 15:03 UTC, reg3f
Details
option not available -project prop (12.98 KB, image/png)
2013-11-17 15:04 UTC, reg3f
Details
works with type cast (54.46 KB, image/png)
2013-11-17 15:04 UTC, reg3f
Details
unable to resolve identifier (42.84 KB, image/png)
2013-11-17 15:04 UTC, reg3f
Details
works with a dev build (30.27 KB, image/png)
2013-11-26 10:13 UTC, reg3f
Details

Note You need to log in before you can comment on or make changes to this bug.
Description reg3f 2013-11-17 15:01:51 UTC
Created attachment 142280 [details]
screencast for test code

e.g.:

* class template with a getInstance() public method:

    template<typename T>
    class Singleton : boost::noncopyable
    {
    public:
        static T* getInstance() {
            ...
        }
        ....

* some children SettingsManager:
        
    class SettingsManager : public Singleton<SettingsManager>, public Speaker<SettingsManagerListener> ...
    
    
* and using something like this:
    SettingsManager::getInstance()->get(setting);
    ......................^
so, we have the next result "unable to resolve identifier"...
    
But! if you use manually type cast, e.g:
  ((Singleton<SettingsManager>)SettingsManager)::getInstance()->get(setting);
  
  this is working fine (see screenshot)

although build is successful in any case with a both variants...problem with only code-completion
I also read http://stackoverflow.com/a/14914647 - BUT this settings is not available! о_О see attach

If i use globally Tools -> Options -> C/C++ -> Code Assistance and/or addition to project properties "Include Directories and Headers": "unable to resolve identifier" has disappeared(notification & highlight getInstance()), but code-completion has not found still - "No Suggestions" 


****
also you can try with the following code:

namespace intellisense {   // <- *1

    template<typename T>
    class TplClass
    {
    public:
        static T* staticType(){};
        static void staticVoid(){};
        void foo(){};
    };
    
    //...

    class Settings : public TplClass<Settings>
    {
    public:

        void show()
        {
            // check here
        };

    private:
        friend class TplClass<Settings>;   // <- *2
    };
    
    //...
    
    class AlsoUse
    {
    public:
        
        void show()
        {
            // check here
        };
        
    };
    
    // etc.,
};


works if you remove *1 or *2
otherwise it is necessary put the TplClass<Settings>:: or ((TplClass)Settings):: etc.

see my video: http://youtu.be/0fW3cpdXgzo
and see attach for more detail

I'm using 7.4
Comment 1 reg3f 2013-11-17 15:03:05 UTC
Created attachment 142281 [details]
No Suggestions
Comment 2 reg3f 2013-11-17 15:03:36 UTC
Created attachment 142282 [details]
option not available
Comment 3 reg3f 2013-11-17 15:04:08 UTC
Created attachment 142283 [details]
option not available -project prop
Comment 4 reg3f 2013-11-17 15:04:26 UTC
Created attachment 142284 [details]
works with type cast
Comment 5 reg3f 2013-11-17 15:04:44 UTC
Created attachment 142285 [details]
unable to resolve identifier
Comment 6 Vladimir Voskresensky 2013-11-26 07:02:13 UTC
Petr, please, evaluate
Comment 7 petrk 2013-11-26 09:09:58 UTC
Hi,

Could you please check it in the latest development version (you can download it from http://bits.netbeans.org/download/trunk/nightly/latest/)? Both of your examples work fine in it, at least on Solaris.

Thanks,
Petr
Comment 8 reg3f 2013-11-26 10:13:40 UTC
Created attachment 142584 [details]
works with a dev build

yep, it works! Build 201311260002 is ok

problem with 7.4 release - https://netbeans.org/downloads/

    Product Version: NetBeans IDE 7.4 (Build 201310111528)
    Java: 1.7.0_40; Java HotSpot(TM) 64-Bit Server VM 24.0-b56
    Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b43
    System: Windows 8 version 6.2 running on amd64; UTF-8; en_us (nb)
Comment 9 petrk 2013-11-26 10:51:51 UTC
Thanks, great! So, I'm closing the bug as worksforme. All would be ok in the next patch.
Comment 10 petrk 2013-11-26 11:27:30 UTC
In fact the fix is already available - you just need to update your IDE (Help->Check for Updates)
Comment 11 reg3f 2013-11-26 12:58:37 UTC
Thanks petrk! all working with patch1

-
how about "Configure Code Assistance" ... as here: http://stackoverflow.com/a/14914647
why not available this option on 7.4 Patch 1 & Dev Build 201311260002 ?

mark as deprecated ? or it activated in special cases ?
-


at least Intellisense now working fine :) !

thanks, again
Comment 12 petrk 2013-11-26 14:34:28 UTC
Yes, there are special cases when you might configure code model "manually" in different ways (using build/exec logs, binaries with debug info, etc.). This option makes sense only for unmanaged projects (for example when project is created outside Netbeans and then imported from existing sources)
Comment 13 reg3f 2013-11-26 14:57:32 UTC
I see., 

thanks for reply