Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

thexaq

macrumors newbie
Original poster
Apr 20, 2010
2
0
Apple's own version of g++ (v4.2.1) segfaults when I compile the following simple program combining block objects and the C++ Standard Template Library. This is a problem for me since I was hoping to use Grand Central Dispatch with my existing C++ code!

Code:
#include <vector>
int main () {
	typedef std::vector<int> returnType;   [COLOR="SeaGreen"]// Define return type for block. Causes error.[/COLOR]
	//typedef int returnType;   [COLOR="SeaGreen"]// (No error with this definition instead)[/COLOR]

	returnType (^blockFcn)();  [COLOR="SeaGreen"]// declare variable of block type[/COLOR]
	blockFcn = ^(){ returnType x; return x; };  [COLOR="SeaGreen"]// define the block[/COLOR]
	returnType test = blockFcn();	  [COLOR="SeaGreen"]// run the block[/COLOR]
	return 0;
}

Results of compiling this code is "i686-apple-darwin10-g++-4.2.1: Internal error: Segmentation fault (program cc1plus)." Anyone have any clue what's going on, and how to fix it?

Cheers and thanks!
-xaq
 
heh, Xcode fail :D
 

Attachments

  • xcode_fail.png
    xcode_fail.png
    30.5 KB · Views: 269
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.