1a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin %s -o - | FileCheck %s
2651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines//
3651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// Test that indirect field decls are handled gracefully.
4651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// rdar://problem/16348575
5651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines//
6651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinestemplate <class T, int T::*ptr> class Foo {  };
7651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines
8651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinesstruct Bar {
9651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  int i1;
10b6d6993e6e6d3daf4d9876794254d20a134e37c2Pirama Arumuga Nainar  // CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int"
11b6d6993e6e6d3daf4d9876794254d20a134e37c2Pirama Arumuga Nainar  // CHECK: !DIDerivedType(tag: DW_TAG_member, scope:
123ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar  // CHECK-SAME:           line: [[@LINE+3]]
133ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar  // CHECK-SAME:           baseType: !"_ZTSN3BarUt_E"
143ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar  // CHECK-SAME:           size: 32, align: 32, offset: 32
15651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  union {
16b6d6993e6e6d3daf4d9876794254d20a134e37c2Pirama Arumuga Nainar    // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i2",
173ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar    // CHECK-SAME:           line: [[@LINE+5]]
183ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar    // CHECK-SAME:           baseType: ![[INT]]
193ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar    // CHECK-SAME:           size: 32, align: 32
203ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar    // CHECK-NOT:            offset:
213ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar    // CHECK-SAME:           ){{$}}
22651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines    int i2;
23651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  };
24651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines};
25651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines
26651f13cea278ec967336033dd032faef0e9fc2ecStephen HinesFoo<Bar, &Bar::i2> the_foo;
27