annotate gcc/testsuite/g++.dg/warn/Wbraces2.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // PR c++/20175
kono
parents:
diff changeset
2 // { dg-options "-Wmissing-braces" }
kono
parents:
diff changeset
3 int a[2][2] = { 0, 1, 2, 3 }; // { dg-warning "missing braces" }
kono
parents:
diff changeset
4 int b[2][2] = { { 0, 1 }, { 2, 3 } };
kono
parents:
diff changeset
5 int c[2][2] = { { { 0 }, 1 }, { 2, 3 } }; // { dg-error "braces around scalar" }
kono
parents:
diff changeset
6 struct S { char s[6]; int i; };
kono
parents:
diff changeset
7 S d = { "hello", 1 };
kono
parents:
diff changeset
8 S e = { { "hello" }, 1 };
kono
parents:
diff changeset
9 S f = { { { "hello" } }, 1 }; // { dg-error "braces around scalar" }
kono
parents:
diff changeset
10 S g = { 'h', 'e', 'l', 'l', 'o', '\0', 1 }; // { dg-warning "missing braces" }
kono
parents:
diff changeset
11 struct T { wchar_t s[6]; int i; };
kono
parents:
diff changeset
12 T i = { L"hello", 1 };
kono
parents:
diff changeset
13 T j = { { L"hello" }, 1 };
kono
parents:
diff changeset
14 T k = { { { L"hello" } }, 1 }; // { dg-error "braces around scalar" }
kono
parents:
diff changeset
15 T l = { L'h', L'e', L'l', L'l', L'o', L'\0', 1 };// { dg-warning "missing braces" }