Bug 375642 - Code completion doesn't offer overrides if parent class derives from template parameter
Summary: Code completion doesn't offer overrides if parent class derives from template...
Status: CONFIRMED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (Clang-based) (show other bugs)
Version: 5.1.0
Platform: Compiled Sources Linux
: NOR minor
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-28 05:05 UTC by Nicolás Alvarez
Modified: 2017-10-16 09:48 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolás Alvarez 2017-01-28 05:05:07 UTC
In this code:

class Base {
    virtual void baseMethod(){}
};
template<typename Parent>
class Derived: public Parent
{
    virtual void derivedMethod(){}
};
class SubDerived: public Derived<Base> {
    
};

Code completion inside SubDerived offers to declare an override for derivedMethod, but not for baseMethod.

(Real-world example of that template pattern: KDevPlatform duchain abstract builders)
Comment 1 Nicolás Alvarez 2017-01-28 05:16:19 UTC
This is a broader issue than just code completion. If I manually declare an override:
class SubDerived: public Derived<Base> {
    virtual void baseMethod();
};

the tooltip for SubDerived::baseMethod doesn't say it's overriding a function from Base. However, clang clearly understands what's going on, because if I use "virtual void baseMethod() override;", it does *not* give the "marked 'override' but does not override" warning.
Comment 2 Venca B Spam 2017-10-16 08:38:10 UTC
It does not work even for simple scenario like this:

file: ClassB.hpp>

#pragma once
template<typename T>
class ClassB
{
public:
    void DoSomething(int T)
    {}
};


file: testClassB.cpp

#include <ClassB.hpp>
void testClassB()
{
    ClassB<int> testInstance;
    testInstance.DoSomething( //here it does not propose arguments
}


In complex C++11,14,17 constructs it stops working complete, leaving me only with Automatic Word Completion nonsense.
Comment 3 Venca B Spam 2017-10-16 08:39:53 UTC
Forgot to mention using KDevelop 5.1.2 from Neon KDE 5.11. The similar behavior observer also in KDevelop 5.0.4 and 5.1.80 from AppImage ran on the same system.
Comment 4 Sven Brauch 2017-10-16 09:48:17 UTC
Yes, this is an issue. It requires something like https://reviews.llvm.org/D37650 to be merged in clang for fixing it.