[asan] enable LeakSanitizer (LSan) by default in asan. This only affects Linux x86_64...
[blocksruntime.git] / test / asan / TestCases / initialization-constexpr.cc
blob65c95edd5081a9a3104698d9a442bc415cf76a27
1 // Constexpr:
2 // We need to check that a global variable initialized with a constexpr
3 // constructor can be accessed during dynamic initialization (as a constexpr
4 // constructor implies that it was initialized during constant initialization,
5 // not dynamic initialization).
7 // RUN: %clangxx_asan -O0 %s %p/Helpers/initialization-constexpr-extra.cc\
8 // RUN: --std=c++11 -fsanitize=init-order -o %t
9 // RUN: ASAN_OPTIONS=check_initialization_order=true %t 2>&1
10 // RUN: %clangxx_asan -O1 %s %p/Helpers/initialization-constexpr-extra.cc\
11 // RUN: --std=c++11 -fsanitize=init-order -o %t
12 // RUN: ASAN_OPTIONS=check_initialization_order=true %t 2>&1
13 // RUN: %clangxx_asan -O2 %s %p/Helpers/initialization-constexpr-extra.cc\
14 // RUN: --std=c++11 -fsanitize=init-order -o %t
15 // RUN: ASAN_OPTIONS=check_initialization_order=true %t 2>&1
16 // RUN: %clangxx_asan -O3 %s %p/Helpers/initialization-constexpr-extra.cc\
17 // RUN: --std=c++11 -fsanitize=init-order -o %t
18 // RUN: ASAN_OPTIONS=check_initialization_order=true %t 2>&1
20 class Integer {
21 private:
22 int value;
24 public:
25 constexpr Integer(int x = 0) : value(x) {}
26 int getValue() {return value;}
28 Integer coolestInteger(42);
29 int getCoolestInteger() { return coolestInteger.getValue(); }
31 int main() { return 0; }