Home | History | Annotate | Download | only in drs
      1 // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
      2 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
      3 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
      4 // RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
      5 
      6 // expected-no-diagnostics
      7 
      8 namespace std {
      9   __extension__ typedef __SIZE_TYPE__ size_t;
     10 
     11   template<typename T> struct initializer_list {
     12     const T *p; size_t n;
     13     initializer_list(const T *p, size_t n);
     14   };
     15 }
     16 
     17 namespace dr1048 { // dr1048: 3.6
     18   struct A {};
     19   const A f();
     20   A g();
     21   typedef const A CA;
     22 #if __cplusplus >= 201103L
     23   // ok: we deduce non-const A in each case.
     24   A &&a = [] (int n) {
     25     while (1) switch (n) {
     26       case 0: return f();
     27       case 1: return g();
     28       case 2: return A();
     29       case 3: return CA();
     30     }
     31   } (0);
     32 #endif
     33 }
     34 
     35 namespace dr1070 { // dr1070: 3.5
     36 #if __cplusplus >= 201103L
     37   struct A {
     38     A(std::initializer_list<int>);
     39   };
     40   struct B {
     41     int i;
     42     A a;
     43   };
     44   B b = {1};
     45   struct C {
     46     std::initializer_list<int> a;
     47     B b;
     48     std::initializer_list<double> c;
     49   };
     50   C c = {};
     51 #endif
     52 }
     53