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

Bug 355304

Summary: Erroneous "unresolved symbol" in explicit template specialization
Product: [Tools] CDT Reporter: sangar
Component: cdt-parserAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Markus Schorn <mschorn.eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug
Version: 8.0   
Target Milestone: 8.1.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description sangar CLA 2011-08-20 22:28:01 EDT
Build Identifier: 20110615-0604

The parser seems to fail inferring the type of an explicitly specialized template of a function, when the type is used as the result type (does not happen when it's used for a parameter of the function).
It does work (not display the error) when explicitly specifying the type like so:

template< typename T >
T f();

template<>
int f<int>() { //< explicit <int> here makes it work
	return 0;
}


Reproducible: Always

Steps to Reproduce:
1. Create new empty C++ project.
2. Create new empty source file.
3. Insert the following code:

template< typename T >
T f();

template<>
int f() { //< Symbol 'f' could not be resolved
	return 0;
}
Comment 1 Markus Schorn CLA 2011-08-23 10:00:50 EDT
Added testcase and fix.
Comment 2 CDT Genie CLA 2011-08-23 10:23:02 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 355304: Argument deduction for explicit function template specialization.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=64c383952a35d928fb255b903e798cadedba2f63