Corentin Jabot 6dc1636815 [Clang] Check for abstract parameters only when functions are defined.
The C++ standard allows abstract parameters in deleted functions
and in function declarations

> The type of a parameter or the return type for a function definition
> shall not be a (possibly cv-qualified) class type that is
> incomplete or abstract within the function body
> unless the function is deleted.

Fixes https://github.com/llvm/llvm-project/issues/63012

Reviewed By: #clang-language-wg, aaron.ballman

Differential Revision: https://reviews.llvm.org/D152096
2023-06-07 21:44:14 +02:00

21 lines
386 B
Plaintext

// RUN: %clang_cc1 -verify %s
@interface A
@end
template<typename T>
struct X0 {
void f(T); // expected-error{{interface type 'A' cannot be passed by value}}
};
X0<A> x0a; // expected-note{{instantiation}}
struct test2 { virtual void foo() = 0; };
@interface Test2
- (void) foo: (test2) foo ;
@end
template<typename T> void r1(__restrict T);
void r2(__restrict id x) { r1(x); }