summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr45079.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr45079.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr45079.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr45079.c b/gcc/testsuite/gcc.dg/pr45079.c
new file mode 100644
index 000000000..1ef02ff78
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr45079.c
@@ -0,0 +1,10 @@
+/* PR c/45079 */
+/* { dg-do compile } */
+
+void
+foo (const char *p, int cond, int a, int b)
+{
+ p[cond ? a : b] = '\0'; /* { dg-error "assignment of read-only location" } */
+}
+
+/* { dg-bogus "not supported by" "" { target *-*-* } 0 } */