#import <Foundation/NSObject.h>
#import <Foundation/NSPointerFunctions.h>
#import <Foundation/NSMapTable.h>
#import <Foundation/NSAutoreleasePool.h>

#import <Foundation/NSString.h>

int main(int argc, char *argv[])
{
	CREATE_AUTORELEASE_POOL(pool);

	NSPointerFunctions *pf = [NSClassFromString(@"NSConcretePointerFunctions") alloc];
	NSLog(@" ---> Alloc %@", pf);

	pf = [pf init];
	NSLog(@" ---> Init %@", pf);

	DESTROY(pf);

	pf = [NSClassFromString(@"NSConcretePointerFunctions") alloc];
	NSLog(@" ---> Alloc %@", pf);

	pf = [pf initWithOptions: NSPointerFunctionsOpaqueMemory];
	NSLog(@" ---> InitWithOptions: %@", pf);

	NSMapTable *map = [[NSMapTable alloc] initWithKeyOptions: NSPointerFunctionsStrongMemory valueOptions: NSPointerFunctionsOpaqueMemory capacity: 0];
	char *str = "bla";

	[map setObject: (id)str forKey: @"string"]; // Crash with Clang 2.9 and trunk but not GCC

	DESTROY(pool);

	return 0;
}
