summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/warn/Wshadow-5.C
blob: 66232913f0e64a7f810bc84ad41ff642c259ecfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Wshadows was giving warnings for nested function parameters in nested class
// or structure that we didn't want.
// { dg-do compile }
// { dg-options "-Wshadow" }

// PR c++/41825
int f (int n)
{
    int bar (int n) { return n++; } // { dg-error "a function-definition is not allowed here" }
    return bar (n); // { dg-error "was not declared in this scope" }
}

int g (int i)
{
    struct {
        int bar (int i) { return i++; } // { dg-bogus "shadows" }
    } s;

    return s.bar (i);
}

// PR c++/30566
void h( int x )
{
  class InnerClass
    {
      public:
              static int g( int x ) // { dg-bogus "shadows" }
                {
                  // empty
                }
    };
}