[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / zero-length-arrays.cpp
blob0802ec70204639c80b4137f0ad8ce06160964602
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
5 class Foo {
6 ~Foo();
7 Foo(const Foo&);
8 public:
9 Foo(int);
12 class Bar {
13 int foo_count;
14 Foo foos[0];
15 #if __cplusplus >= 201103L
16 // expected-note@-2 {{copy constructor of 'Bar' is implicitly deleted because field 'foos' has an inaccessible copy constructor}}
17 #endif
18 Foo foos2[0][2];
19 Foo foos3[2][0];
21 public:
22 Bar(): foo_count(0) { }
23 ~Bar() { }
26 void testBar() {
27 Bar b;
28 Bar b2(b);
29 #if __cplusplus >= 201103L
30 // expected-error@-2 {{call to implicitly-deleted copy constructor of 'Bar}}
31 #else
32 // expected-no-diagnostics
33 #endif
34 b = b2;