1*ebcbe4b6SDavid Blaikie // RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -Wno-null-conversion -fsyntax-only -verify 2*ebcbe4b6SDavid Blaikie // RUN: %clang_cc1 -triple i686-unknown-unknown %s -Wno-null-conversion -fsyntax-only -verify 3dc37c814SDouglas Gregor f()4dc37c814SDouglas Gregorvoid f() { 5dc37c814SDouglas Gregor int* i = __null; 6dc37c814SDouglas Gregor i = __null; 7dc37c814SDouglas Gregor int i2 = __null; 8dc37c814SDouglas Gregor 9dc37c814SDouglas Gregor // Verify statically that __null is the right size 10dc37c814SDouglas Gregor int a[sizeof(typeof(__null)) == sizeof(void*)? 1 : -1]; 1139def3adSAnders Carlsson 1239def3adSAnders Carlsson // Verify that null is evaluated as 0. 1339def3adSAnders Carlsson int b[__null ? -1 : 1]; 14dc37c814SDouglas Gregor } 15a8bea4b9SChandler Carruth 16a8bea4b9SChandler Carruth struct A {}; 17a8bea4b9SChandler Carruth g()18a8bea4b9SChandler Carruthvoid g() { 19a8bea4b9SChandler Carruth (void)(0 ? __null : A()); // expected-error {{non-pointer operand type 'A' incompatible with NULL}} 20a8bea4b9SChandler Carruth (void)(0 ? A(): __null); // expected-error {{non-pointer operand type 'A' incompatible with NULL}} 21a8bea4b9SChandler Carruth } 22