环境
XCode 4.6.2
OSX 10.7.5
NMFoo.h
typedef void(^NMFooBlock)();
struct NMFooStruct {
__unsafe_unretained NMFooBlock fooBlock;
};
typedef struct NMFooStruct NMFooStruct;
@interface NMFoo : NSObject
@end
NMFoo.m
#import "NMFoo.h"
NMFooBlock const NMFooBlockConst = ^{};
NMFooStruct const NMFooStructConst = { .fooBlock = NMFooBlockConst };
@implementation NMFoo
@end
产生一个
错误:初始化元素不是编译时常量 NMFooStruct const NMFooStructConst = { .fooBlock = NMFooBlockConst };
即使 NMFooBlockConst 被定义为 const,这是预期的行为吗?