| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 |
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s |
| 3 |
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s |
| 4 |
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s |
| 5 |
|
| 6 |
class Foo { |
| 7 |
~Foo(); |
| 8 |
Foo(const Foo&); |
| 9 |
public: |
| 10 |
Foo(int); |
| 11 |
}; |
| 12 |
|
| 13 |
class Bar { |
| 14 |
int foo_count; |
| 15 |
Foo foos[0]; |
| 16 |
#if __cplusplus >= 201103L |
| 17 |
// expected-note@-2 {{copy constructor of 'Bar' is implicitly deleted because field 'foos' has an inaccessible copy constructor}} |
| 18 |
#endif |
| 19 |
Foo foos2[0][2]; |
| 20 |
Foo foos3[2][0]; |
| 21 |
|
| 22 |
public: |
| 23 |
Bar(): foo_count(0) { } |
| 24 |
~Bar() { } |
| 25 |
}; |
| 26 |
|
| 27 |
void testBar() { |
| 28 |
Bar b; |
| 29 |
Bar b2(b); |
| 30 |
#if __cplusplus >= 201103L |
| 31 |
// expected-error@-2 {{call to implicitly-deleted copy constructor of 'Bar}} |
| 32 |
#else |
| 33 |
// expected-no-diagnostics |
| 34 |
#endif |
| 35 |
b = b2; |
| 36 |
} |
| 37 |
|
| 38 |
namespace GH170040 { |
| 39 |
#if __cplusplus >= 202002L |
| 40 |
template <int N> struct Foo { |
| 41 |
operator int() const requires(N == 2); |
| 42 |
template <int I = 0, char (*)[(I)] = nullptr> operator long() const; |
| 43 |
}; |
| 44 |
|
| 45 |
void test () { |
| 46 |
Foo<2> foo; |
| 47 |
long bar = foo; |
| 48 |
} |
| 49 |
#endif |
| 50 |
} |