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

Bug 359653

Summary: 'auto' typing with ranged-based for loop
Product: [Tools] CDT Reporter: Jean-Paul RIGAULT <jpr>
Component: cdt-parserAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Anton Leherbauer <aleherb+eclipse>
Severity: enhancement    
Priority: P3 CC: cdtdoug, yevshif
Version: 8.0   
Target Milestone: 8.0.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Jean-Paul RIGAULT CLA 2011-10-02 04:22:09 EDT
When editing this code

	vector<int> v = { 1, 2, 3 };
	for (auto e : v) {
		std::cout << e << std::endl;
	}

I got 'endl' underlined in red with the error message "Invalid overload of 'endl'" (which of course makes no sense). 

If I replace 'auto' by 'int', there is no error. Besides, when 'auto' is not used in a ranged-based for loop (including regular for loop), everything is fine.


-- Configuration Details --
Product: Eclipse 1.4.1.20110909-0613 (org.eclipse.epp.package.cpp.product)
Installed Features:
 org.eclipse.platform 3.7.1.r37x_v20110729-9gF7UHOxFtniV7mI3T556iZN9AU8bEZ1lHMcVK
Comment 1 Markus Schorn CLA 2011-10-06 10:08:20 EDT
Implementation for auto-types in range-based for loops (bug 332883) was incomplete. Added testcase and fix.
Comment 2 CDT Genie CLA 2011-10-06 10:23:01 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 359653: Range based for loop with auto type.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=0137349b87b20b17dff07ef0285d664199e92bfe
Comment 3 CDT Genie CLA 2011-10-06 11:23:00 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 359653: Range based for loop with auto type.

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