2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.dg / other / const2.C
blob86dde1e4559c10d367a7691b4f7a9db9a685fcf8
1 // PR c++/3331: just because 'this' is readonly and bars[0].b is readonly
2 // doesn't mean that the result of the member reference is readonly.
4 struct foo
6   int a;
8   struct bar
9   { int foo::* b ;};
11   static const bar bars[];
13   void bad ()
14   {
15     this->*(bars[0].b) = 42; // { dg-bogus "read-only" "" }
16   }
19 const foo::bar foo::bars[] = { { &foo::a } };
21 int main ()
22 { }