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 218632 - [73cat] No suggestions with ::std::shared_ptr
Summary: [73cat] No suggestions with ::std::shared_ptr
Status: CLOSED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Completion (show other bugs)
Version: 7.2
Hardware: PC Windows 8 x64
: P3 normal with 2 votes (vote)
Assignee: issues@cnd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-19 15:54 UTC by kosmonaffft
Modified: 2013-07-07 15:44 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
No suggestions. (21.65 KB, image/png)
2012-09-19 15:54 UTC, kosmonaffft
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kosmonaffft 2012-09-19 15:54:42 UTC
Created attachment 124591 [details]
No suggestions.

Hello all...

I have some "interface" class with method "virtual double eval(double) const = 0" and typedef "typedef ::std::shared_ptr<ISomeInterface> ISomeInterfacePtr. I have another class holds ISomeInterfacePtr _kernel. When i type "_kernel->" in method body, i suggest autocompletion to show me ISomeInterface methods, but it shows "no suggestions". Also if i type "_kernel." it shows me "no suggestions" instead of ::Std::shared_ptr methods. Example in attachment.
Comment 1 pjulien 2012-09-22 22:06:55 UTC
same with std::unique_ptr
Comment 2 Leonid Lenyashin 2012-10-05 18:19:32 UTC
Somehow it looks as a duplicate, but I might be wrong
Comment 3 nnnnnk 2012-10-25 14:51:16 UTC
I guess the problem is that __GXX_EXPERIMENTAL_CXX0X__ is not defined.

*** This bug has been marked as a duplicate of bug 214186 ***
Comment 4 pjulien 2012-10-25 14:52:47 UTC
(In reply to comment #3)
> I guess the problem is that __GXX_EXPERIMENTAL_CXX0X__ is not defined.
> 
> *** This bug has been marked as a duplicate of bug 214186 ***

That is incorrect, __GXX_EXPERIMENTAL_CXX0X__  is defined.  I can compile std::shared_ptr and unique_ptr but get suggestions from shared_ptr in operator-> instead of the pointee.

If __GXX_EXPERIMENTAL_CXX0X__  wasn't define, I wouldn't be able to compile or run
Comment 5 kosmonaffft 2012-10-25 15:37:59 UTC
Yes. Bug is persist if i manually define __GXX_EXPERIMENTAL_CXX0X__  ...
Comment 6 ctapmex 2012-10-27 08:54:31 UTC
Bug is persist if i manually define __GXX_EXPERIMENTAL_CXX0X__ .

NetBeans IDE Dev (Build 201210270001)  (fix bug http://netbeans.org/bugzilla/show_bug.cgi?id=216570)
gcc 4.7.2 mingw
Comment 7 pjulien 2012-10-27 15:49:53 UTC
OK, so this does indeed work for std::shared_ptr.  What nnnnnk was talking about here wasn't about defining __GXX_EXPERIMENTAL_CXX0X__ for the project but defining __GXX_EXPERIMENTAL_CXX0X__ for Netbeans' internal parser.

So invoking operator-> on std::shared_ptr does produce correct results now.

However, what's strange is that std::unique_ptr doesn't produce any errors in the editor but it still doesn't produce any suggestions either, it just says "No suggestions"

So I think this should stay open for std::unique_ptr

(In reply to comment #3)
> I guess the problem is that __GXX_EXPERIMENTAL_CXX0X__ is not defined.
> 
> *** This bug has been marked as a duplicate of bug 214186 ***
Comment 8 nnnnnk 2012-11-09 10:29:05 UTC
Sample:
template <typename _Tp, typename _Dp>
class my_unique_ptr {

    class _Pointer {
        template<typename _Up>
        static typename _Up::pointer __test(typename _Up::pointer*);

        template<typename _Up>
        static _Tp* __test(...);

        typedef int _Del;

    public:
        typedef decltype(__test<_Del>(0)) type;
        //typedef _Tp* type;
    };

public:
    typedef typename _Pointer::type pointer;

    pointer
    operator->() const {
        return 0;
    }

};

struct A {
    int i;
};

int main(int argc, char** argv) {

    my_unique_ptr<A> ptr;
    ptr->i++;

}
Comment 9 nnnnnk 2012-11-09 10:30:51 UTC
There is a problem with decltype(__test<_Del>(0)) calculation.

Service that would calculate type of expression string in specified context is needed.
Comment 10 kosmonaffft 2013-01-27 12:07:12 UTC
Hello, all...

In NetBeans IDE Dev (Build 201301260001) version autocomplete with ::std::shared_ptr works fine, can anybody confirm this?
Comment 11 kosmonaffft 2013-01-28 03:23:02 UTC
Hm, i've investigated this a bit, and sometimes autocompletion it works, sometimes does not work... It looks like it depends from code complexity, because it works with simple code and does not work in complicated...
Comment 12 timk 2013-02-15 05:59:58 UTC
I just checked NetBeans IDE 7.3 RC2 (Build 201302050851). Suggestions still do not work with std::shared_ptr if the variable is declared with "auto". Ex: for (auto it : vector<shared_ptr<item> > ) 

However, suggestions do work if the "auto" variable is declared by locking a weak pointer. Ex: if (auto item = weak_ptr<item>.lock())

It's getting better but still needs some work.

Thanks to whoever is working on this.
Comment 13 kosmonaffft 2013-07-07 15:44:42 UTC
Works in Build 201307062300...