xref: /PHP-8.3/ext/ffi/tests/bug78270_1.phpt (revision 1cba7764)
1--TEST--
2FR #78270 (Usage of __vectorcall convention with FFI)
3--EXTENSIONS--
4ffi
5zend_test
6--SKIPIF--
7<?php
8if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only");
9
10require_once('utils.inc');
11ob_start();
12phpinfo(INFO_GENERAL);
13$info = ob_get_clean();
14if (preg_match('/Compiler => .*clang.*/', $info)) die("skip not for clang");
15
16try {
17    FFI::cdef(<<<EOC
18        __vectorcall int bug78270(const char *str, size_t str_len);
19        EOC, "php_zend_test.dll");
20} catch (FFI\ParserException $ex) {
21    die('skip __vectorcall not supported');
22}
23?>
24--FILE--
25<?php
26require_once('utils.inc');
27$ffi = FFI::cdef(<<<EOC
28    __vectorcall int bug78270(const char *str, size_t str_len);
29EOC, "php_zend_test.dll");
30var_dump($ffi->bug78270("17.4", 4));
31?>
32--EXPECT--
33int(17)
34