Home | History | Annotate | Download | only in TestCases
      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).
      6 
      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
     19 
     20 class Integer {
     21   private:
     22   int value;
     23 
     24   public:
     25   constexpr Integer(int x = 0) : value(x) {}
     26   int getValue() {return value;}
     27 };
     28 Integer coolestInteger(42);
     29 int getCoolestInteger() { return coolestInteger.getValue(); }
     30 
     31 int main() { return 0; }
     32