3 // RUN: split-file %s %t
5 // RUN: %clang_cc1 -std=c++20 %t/invocable.cppm -emit-module-interface -o %t/invocable.pcm
6 // RUN: %clang_cc1 -std=c++20 %t/lambda.cppm -emit-module-interface -o %t/lambda.pcm -fprebuilt-module-path=%t
7 // RUN: %clang_cc1 -std=c++20 %t/test.cc -fprebuilt-module-path=%t -fsyntax-only -verify
9 // RUN: %clang_cc1 -std=c++20 %t/invocable.cppm -emit-reduced-module-interface -o %t/invocable.pcm
10 // RUN: %clang_cc1 -std=c++20 %t/lambda.cppm -emit-reduced-module-interface -o %t/lambda.pcm -fprebuilt-module-path=%t
11 // RUN: %clang_cc1 -std=c++20 %t/test.cc -fprebuilt-module-path=%t -fsyntax-only -verify
14 export module invocable;
15 export template <class _Fn, class... _Args>
16 concept invocable = requires(_Fn&& __fn, _Args&&... __args) {
20 export template <class _Fn, class _Args>
21 constexpr bool is_callable(_Fn&& __fn, _Args&& __args) {
22 return invocable<_Fn, _Args>;
25 export template <class _Fn>
26 struct Callable : _Fn {
27 constexpr explicit Callable(_Fn &&__fn) : _Fn(static_cast<_Fn&&>(__fn)) {}
29 template <class _Args>
30 constexpr auto operator()(_Args&& __args) {
38 export constexpr auto l = Callable([](auto &&x){});
41 // expected-no-diagnostics
45 static_assert(is_callable(l, 4) == true);