diff options
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/compile/pr46866.c')
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr46866.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46866.c b/gcc/testsuite/gcc.c-torture/compile/pr46866.c new file mode 100644 index 000000000..494114857 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr46866.c @@ -0,0 +1,19 @@ +extern void *malloc(__SIZE_TYPE__); +typedef struct T T; +struct T { + void (*destroy)(void *); +}; +void destroy(union { void *this; } __attribute__((transparent_union))); +static const typeof(destroy) *_destroy = (const typeof(destroy)*)destroy; +void destroy(void *this); +static T *create_empty(void) +{ + T *this = malloc(sizeof(*this)); + *this = (typeof(*this)){ _destroy }; + return this; +} +void openssl_crl_load(void) +{ + T *this = create_empty(); + destroy(this); +} |