summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/zero-length-arrays.cpp
blob: cca883adc4b5d545854bd54c799c68ed80b20b8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s

// <rdar://problem/10228639>
class Foo {
  ~Foo();
  Foo(const Foo&);
public:
  Foo(int);
};

class Bar {
  int foo_count;
  Foo foos[0];
#if __cplusplus >= 201103L
// expected-note@-2 {{copy constructor of 'Bar' is implicitly deleted because field 'foos' has an inaccessible copy constructor}}
#endif
  Foo foos2[0][2];
  Foo foos3[2][0];

public:
  Bar(): foo_count(0) { }    
  ~Bar() { }
};

void testBar() {
  Bar b;
  Bar b2(b);
#if __cplusplus >= 201103L
// expected-error@-2 {{call to implicitly-deleted copy constructor of 'Bar}}
#else
// expected-no-diagnostics
#endif
  b = b2;
}
OpenPOWER on IntegriCloud