OSDN Git Service

2010-04-09 Manuel López-Ibáñez <manu@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / warn / Wshadow-4.C
1 // PR c++/39526
2 // { dg-options "-Wshadow" }
3
4 class INetURLObject
5 {
6 public:
7     INetURLObject(int i);
8     int GetMainURL() const;
9 };
10
11 int foo(int infoo)              // { dg-warning "shadowed declaration" }
12 {
13   int outfoo( INetURLObject( infoo ).GetMainURL()); // { dg-bogus "shadows" }
14   extern void f(int infoo);
15   struct A
16   {
17     void f(int infoo) { }       // { dg-warning "shadows a parameter" }
18   };
19   return outfoo;
20 }
21
22 // PR c++/39763
23 int foo2(void)
24 {
25     int infoo = 0;              // { dg-warning "shadowed declaration" }
26     int outfoo( INetURLObject( infoo ).GetMainURL()); // { dg-bogus "shadows" }
27     struct A
28     {
29       void f(int infoo) { }     // { dg-warning "shadows a previous local" }
30     };
31     return outfoo;
32 }