Bug 258459

Summary: implementing method of template class creates invalid code
Product: [Applications] kdevelop Reporter: Keith Rusler <xzekecomax>
Component: Language Support: CPP (Clang-based)Assignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: amhndu, l.jirkovsky
Priority: NOR    
Version First Reported In: git master   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Keith Rusler 2010-12-01 03:55:46 UTC
Version:           SVN (using Devel) 
OS:                Linux

When adding a template function to a class. When you let KDevelop automatically create the function for you. It does create the function but forgets to add the template<..........> part to the function.

Reproducible: Always

Steps to Reproduce:
1. Create a class.
2. Add a template function.
3. Hit Ctrl+space and highlight to function to generate the function

Actual Results:  
Fails to add the template<.........> to the function.
Comment 1 Milian Wolff 2010-12-01 22:04:48 UTC
please add the test-code so we don't have to reinvent it
Comment 2 Lukas Jirkovsky 2010-12-31 12:22:54 UTC
// START CODE

class Test
{
    template <typename T>
    void someFuction(T arg);
};

// END CODE

Steps to reproduce:
1. Write Test (or a part of it) and request code completion.
2. Select Implement void someFuction(T arg) …

Expected result:

template <typename T>
void Test::someFuction(T arg)
{

}

Result you get:

void Test::someFuction(T arg)
{

}
Comment 3 Lukas Jirkovsky 2010-12-31 12:27:15 UTC
The same goes for class templates. Request implementation of someFunction with the following code:

// CODE
template <typename T>
class Test
{
    void someFuction(T arg);
};
// END CODE

Expected result:
// CODE
template<typename T>
void Test< T >::someFuction(T arg)
{

}
// CODE END

Result you get:
// CODE
void Test< T >::someFuction(T arg)
{

}
// CODE END
Comment 4 Milian Wolff 2016-09-08 16:00:12 UTC
still valid in the clang backend, there we get:


template<T> void Test<T>::someFuction(T arg)
{
}

note the missing "typename" in the `template<T>` part