1 // RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.9 -verify %s
3 #define BOXABLE __attribute__((objc_boxable))
5 typedef struct BOXABLE _NSPoint {
9 typedef struct BOXABLE _NSSize {
13 typedef struct BOXABLE _NSRect {
17 typedef struct BOXABLE _CGPoint {
21 typedef struct BOXABLE _CGSize {
25 typedef struct BOXABLE _CGRect {
29 typedef struct BOXABLE _NSRange {
33 struct _NSEdgeInsets {
37 typedef struct BOXABLE _NSEdgeInsets NSEdgeInsets;
39 typedef struct _SomeStruct {
43 typedef union BOXABLE _BoxableUnion {
47 void checkNSValueDiagnostic(void) {
49 id value = @(rect); // expected-error{{definition of class NSValue must be available to use Objective-C boxed expressions}}
53 + (NSValue *)valueWithBytes:(const void *)value objCType:(const char *)type;
58 id ns_point_value = @(ns_point);
61 id ns_size_value = @(ns_size);
64 id ns_rect_value = @(ns_rect);
67 id cg_point_value = @(cg_point);
70 id cg_size_value = @(cg_size);
73 id cg_rect_value = @(cg_rect);
76 id ns_range_value = @(ns_range);
78 NSEdgeInsets edge_insets;
79 id edge_insets_object = @(edge_insets);
81 BoxableUnion boxable_union;
82 id boxed_union = @(boxable_union);
85 id err = @(s); // expected-error{{illegal type 'SomeStruct' (aka 'struct _SomeStruct') used in a boxed expression}}
88 CGRect getRect(void) {
93 SomeStruct getSomeStruct(void) {
99 id rv_rect = @(getRect());
100 id rv_some_struct = @(getSomeStruct()); // expected-error {{illegal type 'SomeStruct' (aka 'struct _SomeStruct') used in a boxed expression}}