1ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov// Constexpr: 2ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov// We need to check that a global variable initialized with a constexpr 3ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov// constructor can be accessed during dynamic initialization (as a constexpr 4ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov// constructor implies that it was initialized during constant initialization, 5ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov// not dynamic initialization). 6ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov 76efa4d6cf9bb214a5e8ddbb224a69b38c4ae6de6Alexey Samsonov// RUN: %clangxx_asan -O0 %s %p/Helpers/initialization-constexpr-extra.cc\ 8ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov// RUN: --std=c++11 -fsanitize=init-order -o %t 9ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov// RUN: ASAN_OPTIONS=check_initialization_order=true %t 2>&1 106efa4d6cf9bb214a5e8ddbb224a69b38c4ae6de6Alexey Samsonov// RUN: %clangxx_asan -O1 %s %p/Helpers/initialization-constexpr-extra.cc\ 11ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov// RUN: --std=c++11 -fsanitize=init-order -o %t 12ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov// RUN: ASAN_OPTIONS=check_initialization_order=true %t 2>&1 136efa4d6cf9bb214a5e8ddbb224a69b38c4ae6de6Alexey Samsonov// RUN: %clangxx_asan -O2 %s %p/Helpers/initialization-constexpr-extra.cc\ 14ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov// RUN: --std=c++11 -fsanitize=init-order -o %t 15ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov// RUN: ASAN_OPTIONS=check_initialization_order=true %t 2>&1 166efa4d6cf9bb214a5e8ddbb224a69b38c4ae6de6Alexey Samsonov// RUN: %clangxx_asan -O3 %s %p/Helpers/initialization-constexpr-extra.cc\ 17ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov// RUN: --std=c++11 -fsanitize=init-order -o %t 18ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov// RUN: ASAN_OPTIONS=check_initialization_order=true %t 2>&1 19ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov 20ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonovclass Integer { 21ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov private: 22ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov int value; 23ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov 24ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov public: 25ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov constexpr Integer(int x = 0) : value(x) {} 26ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov int getValue() {return value;} 27ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov}; 28ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey SamsonovInteger coolestInteger(42); 29ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonovint getCoolestInteger() { return coolestInteger.getValue(); } 30ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov 31ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonovint main() { return 0; } 32