Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367611 - Range-based for loop should be treated as referencing the relevant begin/end functions
Summary: Range-based for loop should be treated as referencing the relevant begin/end ...
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-28 23:32 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-28 23:32:22 EST
In the following code:


struct intarr
{
    int* first;
    int size;
};

int* begin(const intarr& a) { return a.first; }  // "find references" for this...
int* end(const intarr& a) { return a.first + a.size; }

int main()
{
    intarr a;
    for (int i : a)      // ... does not find this
        ;
}


If I do a "find references" on the "begin" or "end" function, the for loop is not found as a reference, even though it implicitly calls both. Range-based for loops for non-array types always call some begin() and end() functions, and they should be treated as referencing these functions.
Comment 1 Markus Schorn CLA 2012-01-05 05:27:44 EST
I have added implicit names for 'begin' and 'end' to the range based for loop. With that the references are written to the index.