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

Bug 351609

Summary: Problems with const template argument
Product: [Tools] CDT Reporter: Marc-AndrĂ© Laperle <malaperle>
Component: cdt-parserAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Markus Schorn <mschorn.eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug, yevshif
Version: 8.0   
Target Milestone: 8.0.1   
Hardware: All   
OS: All   
Whiteboard:

Description Marc-André Laperle CLA 2011-07-08 16:33:39 EDT
Using CDT8.0.0.201107060210

template<typename Arg>
class Callback
{
public:
    Callback(void (*function)(Arg arg))
    {
    }
};

void Subscribe(const Callback<const int>& callback){}

void CallMe(const int){}

int main()
{
    Subscribe(Callback<const int>(&CallMe)); // invalid arguments, symbol not resolved, here
    return 0;
}

If I extract the callback to a variable then pass it to Subscribe, the problems disappear. If I replace 'const int' for 'int', the problems disappear.
Comment 1 Markus Schorn CLA 2011-07-20 08:09:26 EDT
Added testcase, fixed in 8.0.1 > 20110720.
Comment 2 CDT Genie CLA 2011-07-20 08:19:36 EDT
*** cdt git genie on behalf of 351609 ***

    Bug 351609: Adjust parameter types in instantiated function type.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=d226e960f9c1b40edd2dadefa005d092d1831fdf
Comment 3 CDT Genie CLA 2011-07-20 09:19:34 EDT
*** cdt git genie on behalf of 351609 ***

    Bug 351609: Adjust parameter types in instantiated function type.

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