xref: /llvm-project/compiler-rt/test/tysan/constexpr-subobject.cpp (revision 641fbf1524338c86c952ebb1ec8d2b497ada3cef)
1 // RUN: %clang_tysan -O0 %s -o %t && %run %t >%t.out 2>&1
2 // RUN: FileCheck --allow-empty %s < %t.out
3 
4 // CHECK-NOT: TypeSanitizer
5 
6 int foo() { return 0; }
7 
8 struct Bar {
9   struct S2 {
10     int (*fnA)();
11     int (*fnB)();
12   };
13 
14   static int x() { return 0; }
15 
16   static const S2 &get() {
17     static constexpr S2 Info = {&foo, &Bar::x};
18     return Info;
19   }
20 };
21 
22 int main() {
23   auto Info = Bar::get();
24   return Info.fnB();
25 }
26