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