Bug 378090

Summary: Function override from code completion gets wrong signature for templates
Product: [Applications] kdevelop Reporter: Nicolás Alvarez <nalvarez>
Component: Language Support: CPP (Clang-based)Assignee: kdevelop-bugs-null
Status: RESOLVED WORKSFORME    
Severity: minor    
Priority: NOR    
Version First Reported In: 5.1.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Nicolás Alvarez 2017-03-26 06:10:30 UTC
If a class template 'Base' has a virtual function with template parameters as function parameter types, and I use code completion to override it from a derived class, the override still shows the template parameter (like 'T') instead of the actual type.

For example:

template<typename T>
struct Base {
    virtual void foo(const T& x){}
};

struct Derived: public Base<int>
{
    // trying to override 'foo' using code completion here will write:
    void foo(const T & x) override;
    // instead it should replace 'T' with 'int'
};

// another case:
template<typename ObjType>
struct Derived2: public Base<ObjType>
{
    // code completion here will also write:
    void foo(const T & x) override;
    // it should use the correct template parameter 'ObjType' instead of 'T'
};
Comment 1 Nicolás Alvarez 2017-03-26 06:27:43 UTC
A potentially related problem:

template<typename T>
struct Base {
    virtual void blah(int x);
    virtual void foo(const T& x){}
};

struct Derived: public Base<int>
{
    void blah(int x) override;
    void foo(const int& x) override;

    // code completion here doesn't list "blah" because it knows it's already
    // overridden, but it still shows foo(const T&) because it doesn't realize
    // foo(const int&) is an override of it
};
Comment 2 Justin Zobel 2022-11-03 01:39:50 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 3 Bug Janitor Service 2022-11-18 05:16:10 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Bug Janitor Service 2022-12-03 05:20:08 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!