c++/10364: compile error using vector, comma operator and for loop

pdemarco@ppg.com pdemarco@ppg.com
Wed Apr 9 19:36:00 GMT 2003


>Number:         10364
>Category:       c++
>Synopsis:       compile error using vector, comma operator and for loop
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 09 19:36:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Me
>Release:        g++ (GCC) 3.2 (mingw special 20020817-1)
>Organization:
>Environment:
Windows 2000
>Description:
Here is a strange little bug where the addition of a comma operator kills the compile.  Below it works with 2 ints.
Regards.
--Paul

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
#ifndef FAILS_COMPILE
	std::vector<string>::iterator oCMIter;
	std::vector<string> bites;

	for ( int iI = 3, oCMIter = bites.begin();
				oCMIter != bites.end();
				oCMIter++, iI++ )
	{
		cout << "hello" << endl;
	}
#else
	// works
	int iOne;
	for ( int iI = 3, iOne = 0; iOne < 10; iOne++, iI++ )
	{
		cout << "hello" << endl;
	}
#endif

	return 0;
}
>How-To-Repeat:
g++ foo.cpp
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list