Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.law/cvt11.C

raw
1 // { dg-do assemble }
2 // GROUPS passed conversions
3 // cvt file
4 // Date: Tue, 10 Nov 92 11:08:08 PST
5 // From: [email protected] (Robert R. Henry)
6 // Message-Id: <[email protected]>
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
19 void 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 }
28 Thing::Thing(int y) { x = y; }
29 int main(){ Bar x; x.doit(); }
30