Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367563 - CDT ignores template specialization in header file
Summary: CDT ignores template specialization in header file
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-indexer (show other bugs)
Version: 8.1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 8.1.0   Edit
Assignee: Markus Schorn CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-27 00:35 EST by Nathan Ridge CLA
Modified: 2012-02-23 11:33 EST (History)
1 user (show)

See Also:


Attachments

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