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