Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / g++.dg / warn / effc3.C
blobba2cc03998656974d4aa2aecb3382e18a4577e94
1 // { dg-do compile }
2 // { dg-options "-Weffc++" }
3 // Contributed by Benjamin Kosnik <bkoz at redhat dot com>
4 // PR c++/16165 and PR c++/8211: Improve item 11 of -Weffc++
7 // We should not warn for this class since this kind of pointers can
8 //  never hold dynamic memory.
9 struct A {
10   void (*func1)(void);
11   void (A::*func2)(void);
12   int A::*func3;
14   int a;
15   void b(void);
17   A();
18   ~A();
21 // We do not warn for this class because there is no destructor, so we
22 //  assume there is no dynamic memory allocated (it could point to a
23 //  global variable).
24 struct B {
25   int *ptr;
26   B();
30 // We should emit a warning for these
31 struct C1 {             // { dg-warning "" "" }
32   int *ptr;
33   C1();
34   ~C1();
37 struct C2 {             // { dg-warning "" "" }
38   int *ptr;
39   C2();
40   C2(const C2&);
41   ~C2();
44 struct C3 {             // { dg-warning "" "" }
45   int *ptr;
46   C3();
47   ~C3();
48   C3& operator=(const C3&);
51 // But not for this
52 struct C4 {
53   int *ptr;
54   C4();
55   C4(const C4&);
56   ~C4();
57   C4& operator=(const C4&);