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!
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
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