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

Bug 332884

Summary: Parser fails to deduce argument type in situation involving heavy template use
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, zeratul976
Version: 8.0   
Target Milestone: 8.0   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
source file that reproduces the error
none
header file included by source file that reproduces the error
none
testcase + fix mschorn.eclipse: iplog-

Description Nathan Ridge CLA 2010-12-18 02:46:46 EST
Created attachment 185471 [details]
source file that reproduces the error

For the code in the attached files (test.cpp and test.hpp), the parser gives the following error at the call to a.f(0) in main() in test.cpp:

Invalid arguments Candidates are: void f(?)

The "?" leads me to believe the parser is unable to deduce the type of the argument of f.

Interestingly, any of a number of small changes to the code cause the error to go away. Some of these are:

1. pasting the contents of test.hpp into test.cpp instead of including test.hpp (this one is very suspicious - this shouldn't make a difference at all, should it?)

2. removing the "enclosing" class in test.hpp and putting its contents in namespace scope instead

3. making the "enclosing" class in test.hpp not a template
Comment 1 Nathan Ridge CLA 2010-12-18 02:48:28 EST
Created attachment 185472 [details]
header file included by source file that reproduces the error
Comment 2 Markus Schorn CLA 2010-12-23 10:15:48 EST
Created attachment 185774 [details]
testcase + fix

Thanks for assembling the test case!
Comment 3 Markus Schorn CLA 2010-12-23 10:18:13 EST
Fixed in 8.0 > 20101223.