xref: /aosp_15_r20/external/clang/test/Sema/conditional.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 %s -fsyntax-only -verify
2*67e74705SXin Li 
3*67e74705SXin Li const char* test1 = 1 ? "i" : 1 == 1 ? "v" : "r";
4*67e74705SXin Li 
5*67e74705SXin Li void _efree(void *ptr);
6*67e74705SXin Li void free(void *ptr);
7*67e74705SXin Li 
_php_stream_free1()8*67e74705SXin Li int _php_stream_free1() {
9*67e74705SXin Li   return (1 ? free(0) : _efree(0)); // expected-error {{returning 'void' from a function with incompatible result type 'int'}}
10*67e74705SXin Li }
11*67e74705SXin Li 
_php_stream_free2()12*67e74705SXin Li int _php_stream_free2() {
13*67e74705SXin Li   return (1 ? _efree(0) : free(0));  // expected-error {{returning 'void' from a function with incompatible result type 'int'}}
14*67e74705SXin Li }
15