Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C

raw
1 // { dg-do assemble }
2 // { dg-options "-Wredundant-decls" }
3 // 980413 bkoz
4 // from g++/15307, tests for -Wredundant-decls
5 // for friend functions and functions
6
7
8 extern int foo(const char *);
9
10 class A
11 {
12 friend int foo(const char *);
13 int a;
14 };
15
16 class B
17 {
18 friend int foo(const char *);
19 int foo2() {return b;}
20 int b;
21 };
22
23 class C
24 {
25 friend int foo(const char *);
26 friend int foo(const char *); // { dg-warning "" }
27 int foo2() {return b;}
28 int b;
29 };
30
31 class D
32 {
33 public:
34 int foo2() {return b;} // { dg-message "previous" }
35 int foo2() {return b;} // { dg-error "overloaded" }
36 int b;
37 };
38
39 class E
40 {
41 public:
42 int foo2(); // { dg-message "previous" }
43 int foo2(); // { dg-error "overloaded" }
44 int b;
45 };
46
47 extern int foo3(const char *); // { dg-message "" }
48 extern int foo3(const char *); // { dg-warning "" }