brintos

brintos / llvm-project-archived public Read only

0
0
Text · 665 B · f280d02 Raw
26 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++112// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++143 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 >= 201402L16 17constexpr int g() {18  int a[] = {1, 2, 3};19  auto (&b)[3] = a;20  return b[1];21}22 23static_assert(g() == 2, "");24 25#endif26