Bug 270973 - Semantic analyzer fails with class inheriting from templated typedef
Summary: Semantic analyzer fails with class inheriting from templated typedef
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Unclassified
Component: Language Support: CPP (old) (show other bugs)
Version: 4.2.1
Platform: Fedora RPMs Linux
: NOR normal (vote)
Target Milestone: 4.2.0
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-14 19:02 UTC by Sandro Mani
Modified: 2013-08-08 21:07 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sandro Mani 2011-04-14 19:02:42 UTC
Version:           4.2.1 (using KDE 4.6.2) 
OS:                Linux

Consider this sample program:
-------------------------------------
#include <iostream>

template <typename T>
class A {
public:
	void print(T val){ std::cout<<val<<"\n"; }
};

template <typename T>
struct B {
	typedef A<T> Printer;
};

template <typename T>
class C : public B<T>::Printer {};

int main(int argc, char **argv) {
	B<int>::Printer instance;
	instance.print(2);	
	
	C<int> inherited_instance;
	inherited_instance.print(2);
	
    return 0;
}
-------------------------------------
The semantic analyzer will correctly detect that instance has a member function "print", but fails with inherited_instance.


Reproducible: Always

Steps to Reproduce:
Create new cpp file, let kdevelop analyze the code posted in Details.

Actual Results:  
Functions inherited from templated typedefed classes are not found by the analyzer.

Expected Results:  
Analyzer should find these functions.

OS: Linux (x86_64) release 2.6.35.12-88.fc14.x86_64
Compiler: gcc

kdevplatform-1.2.2-1.fc14.x86_64
kdevelop-4.2.2-1.fc14.x86_64
kdevplatform-libs-1.2.2-1.fc14.x86_64
kdevelop-libs-4.2.2-1.fc14.x86_64

The actual case where I encounter this issue a lot is OpenMesh.
Comment 1 Milian Wolff 2013-08-08 21:07:42 UTC
Git commit 4880f3f5dc2893d540e0030119aefb6b92084fd6 by Milian Wolff.
Committed on 08/08/2013 at 21:06.
Pushed by mwolff into branch 'master'.

Unalias type after delayed type resolution befor baseClass import.

This fixes a bug where semantic analsis failed for typedefed template
arguments in base classes.

M  +2    -1    languages/cpp/cppduchain/templatedeclaration.cpp
A  +46   -0    languages/cpp/tests/cpptestfiles/typedef_template_arg.cpp     [License: LGPL (v2)]

http://commits.kde.org/kdevelop/4880f3f5dc2893d540e0030119aefb6b92084fd6