================ @@ -0,0 +1,231 @@ +// RUN: %clang_cc1 -verify -fsyntax-only %s -std=c++20 + +void func() { // expected-note {{'func' declared here}} + __builtin_invoke(); // expected-error {{too few arguments to function call, expected at least 1, have 0}} +} + +void nfunc() noexcept {} + +struct S {}; +void argfunc(int, S) {} // expected-note {{'argfunc' declared here}} + +struct Callable { + void operator()() {} + + void func() {} + + int var; +}; + +void* malloc(decltype(sizeof(int))); + +template <class T> +struct pointer_wrapper { + T* v; + + T& operator*() { + return *v; + } +}; + +namespace std { + template <class T> + class reference_wrapper { + T* ptr; + + public: + constexpr reference_wrapper(T& ref) : ptr(&ref) {} + + constexpr T& get() { return *ptr; } + }; + + template <class T> + constexpr reference_wrapper<T> ref(T& v) { + return reference_wrapper<T>(v); + } +} // namespace std + +struct InvalidSpecialization1 { + void func() {} + + int var; +}; + +template <> +class std::reference_wrapper<InvalidSpecialization1> { +public: + reference_wrapper(InvalidSpecialization1&) {} +}; + +struct InvalidSpecialization2 { + void func() {} + + int var; +}; + +template <> +class std::reference_wrapper<InvalidSpecialization2> { +public: + reference_wrapper(InvalidSpecialization2&) {} + +private: + InvalidSpecialization2& get(); // expected-note 2 {{declared private here}} +}; + +struct Incomplete; // expected-note {{forward declaration}} +struct Incomplete2; + +void incomplete_test(Incomplete& incomplete) { + __builtin_invoke((int (Incomplete2::*)){}, incomplete); // expected-error {{incomplete type 'Incomplete' used in type trait expression}} \ + expected-error {{indirection requires pointer operand ('Incomplete' invalid)}} +} + ---------------- AaronBallman wrote:
I think we should also have a test for a call through a vanilla function pointer rather than a pointer to member. https://github.com/llvm/llvm-project/pull/116709 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits