Bug 237017 - code completion fails with partial template specialization
Summary: code completion fails with partial template specialization
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-09 21:25 UTC by Ignat Semenov
Modified: 2012-10-28 13:31 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ignat Semenov 2010-05-09 21:25:17 UTC
Version:            (using KDE 4.4.2)
OS:                Linux
Installed from:    Fedora RPMs

There is a template class with two parameters:

template <typename T1, typename T2>
class effective_pair : public T1, public T2 {
    typedef T1 first_type;
    typedef T2 second_type;
};

and a partial specialization of that class:

template <typename T2>
class effective_pair<void, T2> : public T2 {
    typedef void first_type;
    typedef T2 second_type;
};

Now I type this in main.cpp, #include'ing the above definition:

typedef effective_pair

and get code completion with both classes listed. Then I select the partially specialized variant, hit enter and KDevelop inserts this code:

typedef effective_pair< void, T2 ><>

with the cursor being inside the last two angle brackets. This code is incorrect and does not compile. I expect to see this:

typedef effective_pair< void, /*cursor waiting for the second class name*/ >
Comment 1 Ignat Semenov 2010-05-09 21:35:23 UTC
And it looks like that in the code completion list:

class effective_pair< void, T2 ><class T2>

This is not quite correct in my opinion. It should be something along the lines of:

class effective_pair< void, class T2 >

similar to how non-specialized template classes are displayed:

class effective_pair< class T1, class T2 >
Comment 2 Ignat Semenov 2012-01-06 14:37:20 UTC
This bug is still present in the recent master.
Comment 3 Olivier.jg 2012-10-28 13:31:37 UTC
Git commit dcc458b53c7d2cec085de8c23ac6d2d231f35f40 by Olivier JG.
Committed on 28/10/2012 at 14:21.
Pushed by olivierjg into branch 'master'.

Don't generate double template identifiers for specializations during
code completion.
TODO: It would be nice to have the cursor at the first required template
parameter in specializations.

M  +21   -26   languages/cpp/codecompletion/item.cpp

http://commits.kde.org/kdevelop/dcc458b53c7d2cec085de8c23ac6d2d231f35f40