Bug 258459 - implementing method of template class creates invalid code
Summary: implementing method of template class creates invalid code
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (Clang-based) (other bugs)
Version First Reported In: git master
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-01 03:55 UTC by Keith Rusler
Modified: 2018-10-19 16:29 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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