• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -Wno-uninitialized -std=c++1y %s -verify
2 
3 // expected-no-diagnostics
4 
5 struct S { int a; const char *b; int c; int d = b[a]; };
6 constexpr S ss = { 1, "asdf" };
7 
8 static_assert(ss.a == 1, "");
9 static_assert(ss.b[2] == 'd', "");
10 static_assert(ss.c == 0, "");
11 static_assert(ss.d == 's', "");
12 
13 struct X { int i, j, k = 42; };
14 constexpr X a[] = { 1, 2, 3, 4, 5, 6 };
15 constexpr X b[2] = { { 1, 2, 3 }, { 4, 5, 6 } };
16 
operator ==(X a,X b)17 constexpr bool operator==(X a, X b) {
18   return a.i == b.i && a.j == b.j && a.k == b.k;
19 }
20 
21 static_assert(sizeof(a) == sizeof(b), "");
22 static_assert(a[0] == b[0], "");
23 static_assert(a[1] == b[1], "");
24