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