llvm-project/clang/test/SemaCXX/wasm-funcref.cpp
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

14 lines
382 B
C++

// RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -fexceptions -fsyntax-only -verify -triple wasm32 -Wno-unused-value -target-feature +reference-types %s
// Testing that funcrefs work on template aliases
// expected-no-diagnostics
using IntIntFuncref = int(*)(int) __funcref;
using DoubleQual = IntIntFuncref __funcref;
int get(int);
IntIntFuncref getFuncref() {
return get;
}