Bug 213959 - Declaration not found when using template-specialization
Summary: Declaration not found when using template-specialization
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (other bugs)
Version First Reported In: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-10 11:37 UTC by Benjamin Schindler
Modified: 2016-12-13 08:01 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Schindler 2009-11-10 11:37:12 UTC
Version:            (using KDE 4.3.3)
OS:                Linux
Installed from:    Gentoo Packages

I have the following code: 

template <typename T>
struct type_traits;

template <>
struct type_traits<unsigned long>
{
	typedef unsigned long base_type;
	static unsigned long Zero(){return 0;}
};

And then in a header: 

template<typename T> typename type_traits<T>::base_type norm_template(const T &v){ ... }

The Error I'm getting is this: 

Declaration not found: type_traits<T>::base_type Semantic Analysis

I understand that this case is kinda difficult to handle, but the current behaviour is not optimal (btw, it would be nice if I could copy the error message out of the problems window)

The same happens when it really shouldn't: 

template <>
struct type_traits<Eigen::Vector2f>
{
    typedef float base_type;
    static const char* id() { return "Vector2f"; }
	static Eigen::Vector2f Zero(){return Eigen::Vector2f::Zero();}
};

Declaration not found: Eigen::Vector2f::Zero (note, Eigen is included using Eigen/Core)
Comment 1 Olivier.jg 2012-10-24 20:54:52 UTC
I don't get any semantic analysis errors with the given code.

As far as Eigen::Vector2f, fgrep can't find that in eigen2 either, so that's correct to me.

It's possible it was fixed recently. Let me know if you can provide a way to reproduce on current stable (4.4) or master.
Comment 2 Benjamin Schindler 2012-10-24 22:33:17 UTC
I'm not using kdevelop anymore, but eigen does have Vector2f. These typedefs are generated using macros so a grep won't find them. 

The following code should (note, I just typed it here) compile and run. That is a good proof of the existence of Vector2f. Judging from your comment, kdevelop still does not find Vector2f, so I'm reopening this. 

#include <Eigen/Core>
#include <iostream>
using namespace Eigen;

int main()
{
Vector2f myVector(1.0, 2.0);
std::cout << myVector.transpose() << std::endl;
return 0;
}
Comment 3 Rahul 2016-05-09 17:26:06 UTC
I have tried to reproduce this issue on Kdevelop 4.90.92 but it looks like this bug is already fixed. Please let me know if you need any additional information. Thanks.
Comment 4 Kevin Funk 2016-05-09 17:52:02 UTC
Thanks for the feedback. Closing.