llvm-project/clang/test/Parser/wasm-funcref.c
Paulo Matos 8d0c889752 [clang][WebAssembly] Initial support for reference type funcref in clang
This is the funcref counterpart to 890146b. We introduce a new attribute
that marks a function pointer as a funcref. It also implements builtin
__builtin_wasm_ref_null_func(), that returns a null funcref value.

Differential Revision: https://reviews.llvm.org/D128440
2023-03-17 18:31:44 +01:00

10 lines
503 B
C

// RUN: %clang_cc1 -triple powerpc-linux-gnu -fsyntax-only -verify %s
// Test that we trigger an error at parse time if using keyword funcref
// while not using a wasm triple.
typedef void (*__funcref funcref_t)(); // expected-error {{invalid use of '__funcref' keyword outside the WebAssembly triple}}
typedef int (*__funcref fn_funcref_t)(int);// expected-error {{invalid use of '__funcref' keyword outside the WebAssembly triple}}
typedef int (*fn_t)(int);
static fn_funcref_t nullFuncref = 0;