Bug 158692 - Template unresolved identifier
Template unresolved identifier
Status: NEW
Product: cnd
Classification: Unclassified
Component: Code Model
6.x
All Linux
: P1 with 2 votes (vote)
: 7.2
Assigned To: issues@cnd
issues@cnd
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-02-17 17:23 UTC by rmartins
Modified: 2013-05-07 11:21 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rmartins 2009-02-17 17:23:46 UTC
Hi,
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1>
class ACE_Connector : public ACE_Connector_Base<SVC_HANDLER>, public ACE_Service_Object
{
public:

  // Useful STL-style traits.
  typedef typename SVC_HANDLER::addr_type        addr_type;
//...
};
The SVC_HANDLER::addr_type appears as unresolved, but we should have been presented with a dialog with the possible
templates/class matches:
addr_type - ace/Svc_Handler.h
addr_type - ace/Acceptor.h
//...


P.S.:
the code is from ACE, http://www.cs.wustl.edu/~schmidt/ACE.html.
Comment 1 nnnnnk 2009-02-17 17:59:46 UTC
"addr_type" should be marked as warning now. 
Is it marked as error?

We can't completely resolve "addr_type" because we can't make any assumptions about SVC_HANDLER.
It's possible to check all instantiations than take intersection of members of it's template parameters and than match
it with nested type of template parameter inside template definition. 
But this operation could be too time expensive. 
It could be implemented as additional service "Check template instantiations".
Anyway it's enhancement.
Comment 2 rmartins 2009-03-18 12:14:08 UTC
A suggestion/question:
Would it be possible to restrict the proposed bindings based on a set of
restrictions? For example:

class TestCase1{
public:
    TestCase1(){}
    ~TestCase1(){}

    void close(void){}
}


class TestCase2{
public:
    TestCase2(){}
    ~TestCase2(){}

    void close(void){}
    int flush(int max){ return 0;}
}



template <class X>
class B1 {
public:
        B1(X* x):m_x(x){}
        virtual ~B1(){}

        void method1(){
           m_x->close();
        }        
protected:
        X m_x;

};

In this case, when we try to "Open declaration" on x->close(), we should be
presented with both TestCase1 & TestCase2.

But if we had the following:
template <class X>
class B2 {
public:
        B2(X* x):m_x(x){}
        virtual ~B2(){}

        void method1(){
           m_x->close();
        }  
        void method2(){
              int ret = m_x->flush(0);
        }       

protected:
        X m_x;

};
Here it would be interesting to only proposal TestCase2 if we try to "Open
declaration" on m_x->flush() or m_x->close(), because it's the only one that
has both methods.

What do you think of this?
Comment 3 nnnnnk 2009-03-18 16:05:48 UTC
I think it's another good enhancement.

But It seems to me that this approach is hard to implement as part of completion or hyperlink.
Completion has about 200 milliseconds. So for big project it would be hard to analyze all possible for instantiation
classes.
Or such data should be recalculated. But I guess such calculation would take a lot of time and memory.
Comment 4 nnnnnk 2009-03-18 16:11:23 UTC
In C++0X there will be special feature Concepts.
http://en.wikipedia.org/wiki/C%2B%2B0x#Concepts

Support of such feature in IDE can solve the problem too.
Comment 5 rmartins 2009-03-18 16:29:49 UTC
I think you are right on the C++0X support!

A way to mitigate the problem of long delays, would be with a preference associate with this kind of feature.
If on, then all the calculations would be perform, off otherwise. 
Perhaps with the current development pace of CND (with the improvement of parsing and code model), this won't be a problem.



By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo