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 75d71de26cedae3dafc17449fe0182045c0bd20e8Stephen Hines// RUN: %clangxx_asan -O0 %s %p/Helpers/initialization-constexpr-extra.cc --std=c++11 -o %t 82d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines// RUN: env ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 95d71de26cedae3dafc17449fe0182045c0bd20e8Stephen Hines// RUN: %clangxx_asan -O1 %s %p/Helpers/initialization-constexpr-extra.cc --std=c++11 -o %t 102d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines// RUN: env ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 115d71de26cedae3dafc17449fe0182045c0bd20e8Stephen Hines// RUN: %clangxx_asan -O2 %s %p/Helpers/initialization-constexpr-extra.cc --std=c++11 -o %t 122d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines// RUN: env ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 135d71de26cedae3dafc17449fe0182045c0bd20e8Stephen Hines// RUN: %clangxx_asan -O3 %s %p/Helpers/initialization-constexpr-extra.cc --std=c++11 -o %t 142d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines// RUN: env ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1 15ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov 16ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonovclass Integer { 17ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov private: 18ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov int value; 19ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov 20ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov public: 21ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov constexpr Integer(int x = 0) : value(x) {} 22ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov int getValue() {return value;} 23ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov}; 24ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey SamsonovInteger coolestInteger(42); 25ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonovint getCoolestInteger() { return coolestInteger.getValue(); } 26ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonov 27ce184c8657d7ef3f165fd7561b8f6c06c4ecbe4dAlexey Samsonovint main() { return 0; } 28