summaryrefslogtreecommitdiff
path: root/clang/test/CXX/dcl.dcl/dcl.link/p7.cpp
blob: bd9ff3c3665c26b4ca58958ab4f594638f1f54cc (about) (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
// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s

struct X { };

// CHECK: @x1 = global %struct.X zeroinitializer
// CHECK: @x4 = global %struct.X zeroinitializer
// CHECK: @x2 = external global %struct.X
// CHECK: @x3 = external global %struct.X
extern "C" {


  X x1;
}

extern "C" X x2;

extern X x3;

X x4;

X& get(int i) {
  if (i == 1)
    return x1;
  else if (i == 2)
    return x2;
  else if (i == 3)
    return x3;
  else
    return x4;
}