1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s 2f4a2713aSLionel Sambuc // PR 1603 func()3f4a2713aSLionel Sambucvoid func() 4f4a2713aSLionel Sambuc { 5f4a2713aSLionel Sambuc const int *arr; 6*0a6a1f1dSLionel Sambuc arr[0] = 1; // expected-error {{read-only variable is not assignable}} 7f4a2713aSLionel Sambuc } 8f4a2713aSLionel Sambuc 9f4a2713aSLionel Sambuc struct foo { 10f4a2713aSLionel Sambuc int bar; 11f4a2713aSLionel Sambuc }; 12f4a2713aSLionel Sambuc struct foo sfoo = { 0 }; 13f4a2713aSLionel Sambuc func2()14f4a2713aSLionel Sambucint func2() 15f4a2713aSLionel Sambuc { 16f4a2713aSLionel Sambuc const struct foo *fp; 17f4a2713aSLionel Sambuc fp = &sfoo; 18*0a6a1f1dSLionel Sambuc fp[0].bar = 1; // expected-error {{read-only variable is not assignable}} 19f4a2713aSLionel Sambuc return sfoo.bar; 20f4a2713aSLionel Sambuc } 21