OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [warn/] [effc3.C] - Blame information for rev 853

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do compile }
2
// { dg-options "-Weffc++" }
3
// Contributed by Benjamin Kosnik 
4
// PR c++/16165 and PR c++/8211: Improve item 11 of -Weffc++
5
 
6
 
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;
13
 
14
  int a;
15
  void b(void);
16
 
17
  A();
18
  ~A();
19
};
20
 
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();
27
};
28
 
29
 
30
// We should emit a warning for these
31
struct C1 {             // { dg-warning "" "" }
32
  int *ptr;
33
  C1();
34
  ~C1();
35
};
36
 
37
struct C2 {             // { dg-warning "" "" }
38
  int *ptr;
39
  C2();
40
  C2(const C2&);
41
  ~C2();
42
};
43
 
44
struct C3 {             // { dg-warning "" "" }
45
  int *ptr;
46
  C3();
47
  ~C3();
48
  C3& operator=(const C3&);
49
};
50
 
51
// But not for this
52
struct C4 {
53
  int *ptr;
54
  C4();
55
  C4(const C4&);
56
  ~C4();
57
  C4& operator=(const C4&);
58
};

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.