Bus error gcc compiler for any for ( x in array ) inside Objective-C++ template

Ian Lance Taylor iant@google.com
Thu Oct 15 22:42:00 GMT 2009


John Holdsworth <mac@johnholdsworth.com> writes:

> I've encountered a bus error using Apple's gcc in Xcode 3.1, 3.2
> compiling  the following code or any containing for( x in y ) is used
> inside a template in Objective-C++.
>
> template <typename ETYPE>
> class OODictionary {
> 	void boom() {
> 		NSArray *keys = nil;
> 		for ( NSString *key in keys ) {
> 		}
> 	}
> };
>
> I've not been able to build with a more recent gcc so I can't tell
> if it is still present but figure I'd better let you guys know.

I tried your test case with current mainline, and got a bunch of
errors.

/home/iant/foo.mm: In member function ‘void OODictionary<ETYPE>::boom()’:
/home/iant/foo.mm:4:3: error: ‘NSArray’ was not declared in this scope
/home/iant/foo.mm:4:12: error: ‘keys’ was not declared in this scope
/home/iant/foo.mm:4:19: error: ‘nil’ was not declared in this scope
/home/iant/foo.mm:5:9: error: ‘NSString’ was not declared in this scope
/home/iant/foo.mm:5:19: error: ‘key’ was not declared in this scope
/home/iant/foo.mm:5:23: error: expected ‘;’ before ‘in’
/home/iant/foo.mm:7:2: error: expected primary-expression before ‘}’ token
/home/iant/foo.mm:7:2: error: expected ‘;’ before ‘}’ token
/home/iant/foo.mm:7:2: error: expected primary-expression before ‘}’ token
/home/iant/foo.mm:7:2: error: expected ‘)’ before ‘}’ token
/home/iant/foo.mm:7:2: error: expected primary-expression before ‘}’ token
/home/iant/foo.mm:7:2: error: expected ‘;’ before ‘}’ token

Since I don't know Objective C++ at all, I don't know whether this is
expected.

In any case, I encourage you to file a bug report with a
self-contained test case.  Please follow the directions at
http://gcc.gnu.org/bugs.html .  Thanks.

Ian



More information about the Gcc mailing list