• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // GCC 5 does not evaluate static assertions dependent on a template parameter.
10 // UNSUPPORTED: gcc-5
11 
12 // <array>
13 
14 // void swap(array& a);
15 
16 #include <array>
17 #include <cassert>
18 
19 // std::array is explicitly allowed to be initialized with A a = { init-list };.
20 // Disable the missing braces warning for this reason.
21 #include "disable_missing_braces_warning.h"
22 
main(int,char **)23 int main(int, char**) {
24   {
25     typedef double T;
26     typedef std::array<const T, 0> C;
27     C c = {};
28     C c2 = {};
29     // expected-error-re@array:* {{static_assert failed {{.*}}"cannot swap zero-sized array of type 'const T'"}}
30     c.swap(c2); // expected-note {{requested here}}
31   }
32 
33   return 0;
34 }
35