1 // { dg-do assemble } 2 // GROUPS passed conversions 3 // cvt file 4 // Date: Tue, 10 Nov 92 11:08:08 PST 5 // From: rrh@tera.com (Robert R. Henry) 6 // Message-Id: <9211101908.AA13557@tera.com> 7 // Subject: type cast of qualified const member breaks g++2.3.1 8 9 #include <stdio.h> 10 11 class Thing{ 12 private: int x; 13 public: const int N = -1; // { dg-error "" "" { target { ! c++11 } } } bad initialization 14 Thing(int y); 15 }; 16 17 class Bar{ public: void doit(void); }; 18 doit(void)19void Bar::doit(void) 20 { 21 int i, j; 22 i = Thing::N; // { dg-error "non-static" } 23 printf("i = %d\n", i); 24 25 j = (int)Thing::N; // { dg-error "non-static" } 26 printf("i = %d\n", j); 27 } Thing(int y)28Thing::Thing(int y) { x = y; } main()29int main(){ Bar x; x.doit(); } 30 31