Clang Project

clang_source_code/test/CodeGenCXX/incomplete-types.cpp
1// RUN: %clang_cc1 %s -emit-llvm-only -verify
2// expected-no-diagnostics
3// PR5489
4
5template<typename E>
6struct Bar {
7 int x_;
8};
9
10static struct Bar<int> bar[1] = {
11  { 0 }
12};
13
14
15
16namespace incomplete_type_refs {
17  struct A;
18  extern A g[];
19  void foo(A*);
20  void f(void) {
21    foo(g);    // Reference to array with unknown element type.
22  }
23
24  struct A {   // define the element type.
25    int a,b,c;
26  };
27
28  A *f2() {
29    return &g[1];
30  }
31
32}
33
34namespace PR10395 {
35  struct T;
36  extern T x[];
37  T* f() { return x; }
38}
39
40namespace PR10384 {
41  struct X;
42  extern X x[1];
43  X* f() { return x; }
44}
45