xref: /PHP-8.4/ext/ffi/tests/023.phpt (revision 4acf0084)
1--TEST--
2FFI 023: GCC struct extensions
3--EXTENSIONS--
4ffi
5--INI--
6ffi.enable=1
7--FILE--
8<?php
9    $ffi = FFI::cdef();
10
11    try {
12        var_dump(FFI::sizeof($ffi->new("struct {}")));
13    } catch (Throwable $e) {
14        echo get_class($e) . ": " . $e->getMessage() . "\n";
15    }
16    var_dump(FFI::sizeof($ffi->new("struct {int a}")));
17    var_dump(FFI::sizeof($ffi->new("struct {int a; int b}")));
18?>
19ok
20--EXPECT--
21FFI\Exception: Cannot instantiate FFI\CData of zero size
22int(4)
23int(8)
24ok
25