[PATCH v2] RISC-V: Fix gcc.target/riscv/rvv/base/cpymem-1.c f3
[official-gcc.git] / gcc / testsuite / gcc.dg / lvalue-8.c
blob04eeb71b6bca7548876c78bc8a614b16f4226db7
1 /* PR c/66341 */
2 /* { dg-do compile } */
4 void
5 foo (int *p)
7 p = 0;
8 /* A cast does not yield an lvalue. */
9 (int *) p = 0; /* { dg-error "lvalue required as left operand of assignment" } */
10 /* A cast to a qualified type has the same effect as a cast
11 to the unqualified version of the type. */
12 (int *const) p = 0; /* { dg-error "lvalue required as left operand of assignment" } */
13 (int *) (char *) p = 0; /* { dg-error "lvalue required as left operand of assignment" } */
14 (int *) (char *) (int *) p = 0; /* { dg-error "lvalue required as left operand of assignment" } */
15 (int *) (char *) (int *) (char *) p = 0; /* { dg-error "lvalue required as left operand of assignment" } */
16 (int *) (double *) p = 0; /* { dg-error "lvalue required as left operand of assignment" } */
17 (int *) (int *) p = 0; /* { dg-error "lvalue required as left operand of assignment" } */
18 (int *) (int *const) p = 0; /* { dg-error "lvalue required as left operand of assignment" } */