OSDN Git Service

PR c++/15759
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / other / const2.C
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.
3
4 struct foo
5 {
6   int a;
7
8   struct bar
9   { int foo::* b ;};
10
11   static const bar bars[];
12
13   void bad ()
14   {
15     this->*(bars[0].b) = 42; // { dg-bogus "read-only" "" }
16   }
17 };
18
19 const foo::bar foo::bars[] = { { &foo::a } };
20
21 int main ()
22 { }