brintos

brintos / llvm-project-archived public Read only

0
0
Text · 377 B · 0a3e9d4 Raw
21 lines · c
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// PR 16033void func(void)4{5   const int *arr;6   arr[0] = 1;  // expected-error {{read-only variable is not assignable}}7}8 9struct foo {10  int bar;11};12struct foo sfoo = { 0 };13 14int func2(void)15{16  const struct foo *fp;17  fp = &sfoo;18  fp[0].bar = 1;  // expected-error {{read-only variable is not assignable}}19  return sfoo.bar;20}21