| 1 |
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s |
| 2 |
|
| 3 |
template <typename T> static void destroy() { |
| 4 |
T t; |
| 5 |
++t; |
| 6 |
} |
| 7 |
|
| 8 |
struct Incomplete; |
| 9 |
|
| 10 |
template <typename = int> struct HasD { |
| 11 |
~HasD() { destroy<Incomplete*>(); } |
| 12 |
}; |
| 13 |
|
| 14 |
struct HasVT { |
| 15 |
virtual ~HasVT(); |
| 16 |
}; |
| 17 |
|
| 18 |
struct S : HasVT { |
| 19 |
HasD<> v; |
| 20 |
}; |
| 21 |
|
| 22 |
// Ensure we don't get infinite recursion from the check, however. See GH104802 |
| 23 |
namespace GH104802 { |
| 24 |
class foo { // expected-note {{definition of 'GH104802::foo' is not complete until the closing '}'}} |
| 25 |
foo a; // expected-error {{field has incomplete type 'foo'}} |
| 26 |
|
| 27 |
virtual int c(); |
| 28 |
}; |
| 29 |
|
| 30 |
class bar { // expected-note {{definition of 'GH104802::bar' is not complete until the closing '}'}} |
| 31 |
const bar a; // expected-error {{field has incomplete type 'const bar'}} |
| 32 |
|
| 33 |
virtual int c(); |
| 34 |
}; |
| 35 |
|
| 36 |
class baz { // expected-note {{definition of 'GH104802::baz' is not complete until the closing '}'}} |
| 37 |
typedef class baz blech; |
| 38 |
blech a; // expected-error {{field has incomplete type 'blech' (aka 'GH104802::baz')}} |
| 39 |
|
| 40 |
virtual int c(); |
| 41 |
}; |
| 42 |
|
| 43 |
class quux : quux { // expected-error {{base class has incomplete type}} \ |
| 44 |
expected-note {{definition of 'GH104802::quux' is not complete until the closing '}'}} |
| 45 |
virtual int c(); |
| 46 |
}; |
| 47 |
} |