aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-02-24 22:21:28 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2005-02-24 22:21:28 +0100
commit6ecfe13b3e6ab72ebeccae0689b0f619d09c0828 (patch)
tree7a8ce7fee9ee6b7bb54f57d5822ec94c12ab380f /gcc/testsuite
parenta0d2281e2d912d1e593a7272cfa0c291c1fc81f2 (diff)
downloadgcc-6ecfe13b3e6ab72ebeccae0689b0f619d09c0828.zip
gcc-6ecfe13b3e6ab72ebeccae0689b0f619d09c0828.tar.gz
gcc-6ecfe13b3e6ab72ebeccae0689b0f619d09c0828.tar.bz2
re PR c++/20175 (Warnings are issued when initializing struct members with "strings")
PR c++/20175 * decl.c (reshape_init): Don't warn about missing braces if STRING_CST initializes a char/wchar_t array. * g++.dg/warn/Wbraces2.C: New test. From-SVN: r95512
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/warn/Wbraces2.C15
2 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6f590f3..1b1a9c4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-02-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/20175
+ * g++.dg/warn/Wbraces2.C: New test.
+
2005-02-23 Mark Mitchell <mark@codesourcery.com>
PR c++/19878
diff --git a/gcc/testsuite/g++.dg/warn/Wbraces2.C b/gcc/testsuite/g++.dg/warn/Wbraces2.C
new file mode 100644
index 0000000..b51d5ca
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wbraces2.C
@@ -0,0 +1,15 @@
+// PR c++/20175
+// { dg-options "-Wmissing-braces" }
+int a[2][2] = { 0, 1, 2, 3 }; // { dg-warning "missing braces" }
+int b[2][2] = { { 0, 1 }, { 2, 3 } };
+int c[2][2] = { { { 0 }, 1 }, { 2, 3 } }; // { dg-error "brace-enclosed" }
+struct S { char s[6]; int i; };
+S d = { "hello", 1 };
+S e = { { "hello" }, 1 };
+S f = { { { "hello" } }, 1 }; // { dg-error "brace-enclosed" }
+S g = { 'h', 'e', 'l', 'l', 'o', '\0', 1 }; // { dg-warning "missing braces" }
+struct T { wchar_t s[6]; int i; };
+T i = { L"hello", 1 };
+T j = { { L"hello" }, 1 };
+T k = { { { L"hello" } }, 1 }; // { dg-error "brace-enclosed" }
+T l = { L'h', L'e', L'l', L'l', L'o', L'\0', 1 };// { dg-warning "missing braces" }