Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367563

Summary: CDT ignores template specialization in header file
Product: [Tools] CDT Reporter: Nathan Ridge <zeratul976>
Component: cdt-indexerAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Markus Schorn <mschorn.eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug
Version: 8.1.0   
Target Milestone: 8.1.0   
Hardware: All   
OS: All   
Whiteboard:

Description Nathan Ridge CLA 2011-12-27 00:35:14 EST
In the following code, test.hpp forward-declares a template class, and defines a specialization of it; test.cpp then defines the general template. It seems that in this arrangement, CDT ignores the specialization in the header, as indicated by the following error:


test.hpp:

#ifndef TEST_HPP_
#define TEST_HPP_

template <typename>
struct foo;

template <>
struct foo<int>
{
    typedef int type;
};

#endif  // TEST_HPP_


test.cpp:

#include "test.hpp"

template <typename>
struct foo
{
};

int main()
{
    typedef foo<int>::type type;  // ERROR HERE: 'foo<int>::type' could not be resolved
}


The code compiles fine with GCC.
Comment 1 Markus Schorn CLA 2012-01-03 10:44:16 EST
There was a similar issue with partial specializations.
Added testcases and fix.