1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 2 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++14 3 f()4void f() { 5 int a[5]; 6 auto (*b)[5] = &a; 7 auto (&c)[5] = a; 8 auto (&&d)[5] = static_cast<int(&&)[5]>(a); 9 auto e[] = {0}; // expected-error{{cannot deduce actual type for variable 'e' with type 'auto[]' from initializer list}} 10 static_assert(__is_same(decltype(b), int (*)[5]), ""); 11 static_assert(__is_same(decltype(c), int (&)[5]), ""); 12 static_assert(__is_same(decltype(d), int (&&)[5]), ""); 13 } 14 15 #if __cplusplus >= 201402L 16 g()17constexpr int g() { 18 int a[] = {1, 2, 3}; 19 auto (&b)[3] = a; 20 return b[1]; 21 } 22 23 static_assert(g() == 2, ""); 24 25 #endif 26