aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/array-lit.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-05-26 17:13:23 -0400
committerJason Merrill <jason@gcc.gnu.org>2012-05-26 17:13:23 -0400
commit1f37c58399cc1cd5047b8464f09b9af750f129af (patch)
tree215d3cb4dc23743144db979c43a787f2ed6b3027 /gcc/testsuite/c-c++-common/array-lit.c
parentc4c57c9cbeda074a1e21d469575510791ed8667e (diff)
downloadgcc-1f37c58399cc1cd5047b8464f09b9af750f129af.zip
gcc-1f37c58399cc1cd5047b8464f09b9af750f129af.tar.gz
gcc-1f37c58399cc1cd5047b8464f09b9af750f129af.tar.bz2
re PR c++/53220 (g++ mis-compiles compound literals)
PR c++/53220 gcc/ * c-typeck.c (array_to_pointer_conversion): Give -Wc++-compat warning about array compound literals. gcc/cp/ * call.c (convert_like_real) [ck_list]: Take array address directly. * typeck.c (decay_conversion): Reject decay of an array compound literal. From-SVN: r187916
Diffstat (limited to 'gcc/testsuite/c-c++-common/array-lit.c')
-rw-r--r--gcc/testsuite/c-c++-common/array-lit.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/array-lit.c b/gcc/testsuite/c-c++-common/array-lit.c
new file mode 100644
index 0000000..6505c20
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/array-lit.c
@@ -0,0 +1,12 @@
+/* { dg-options "-std=c99 -Wc++-compat -Werror" { target c } } */
+/* { dg-prune-output "treated as errors" } */
+#include <stdio.h>
+
+int main()
+{
+ for (int *p = (int[]){ 1, 2, 3, 0 }; /* { dg-error "array" } */
+ *p; ++p) {
+ printf("%d\n", *p);
+ }
+ return 0;
+}