xref: /PHP-8.0/ext/ffi/tests/bug77768.phpt (revision c5401854)
1--TEST--
2Bug #77768 (Redeclaration of builtin types and repeated declarations)
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6try {
7    $libc = FFI::cdef("int printf(const char *format, ...);", "libc.so.6");
8} catch (Throwable $_) {
9    die('skip libc.so.6 not available');
10}
11?>
12--INI--
13ffi.enable=1
14--FILE--
15<?php
16$x = FFI::cdef("
17typedef __builtin_va_list __gnuc_va_list;
18typedef unsigned int uint8_t;
19
20typedef int64_t a;
21typedef int64_t b;
22typedef a c;
23typedef b c;
24
25struct point {int x,y;};
26
27typedef struct point d;
28typedef struct point d;
29
30int printf(const char *format, ...);
31int printf(const char *format, ...);
32");
33
34var_dump(FFI::sizeof($x->new("uint8_t")));
35var_dump(FFI::sizeof(FFI::new("uint8_t")));
36?>
37--EXPECT--
38int(4)
39int(1)
40