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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [warn/] [Wshadow-6.C] - Blame information for rev 774

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

Line No. Rev Author Line
1 693 jeremybenn
// Test the declaration of nested lambda function shadows
2
// a parameter or previous local.
3
// { dg-do compile }
4
// { dg-options "-std=c++0x -Wshadow" }
5
 
6
struct S {};
7
int f1(int x)   // { dg-warning "shadowed declaration" }
8
{
9
 int t = 0;
10
 int m = 0;     // { dg-warning "shadowed declaration" }
11
 [&t] (int x) { // { dg-warning "shadows a parameter" }
12
   int m = 1;   // { dg-warning "shadows a previous local" }
13
   t = t + x + m;
14
 };
15
 return t;
16
}
17
 
18
void f2(struct S i, int j) {
19
  struct A {
20
    struct S x;
21
    void g(struct S i) { // { dg-warning "shadowed declaration" }
22
          struct S x;    // { dg-warning "shadows a member of" }
23
          struct S y;    // { dg-warning "shadowed declaration" }
24
          int t;
25
           [&t](struct S i){   // { dg-warning "shadows a parameter" }
26
                 int j = 1;    // { dg-bogus "shadows" }
27
                 struct S y;   // { dg-warning "shadows a previous local" }
28
                 t = j;
29
           };
30
    }
31
  };
32
}
33
 
34
void f3(int i) {
35
 [=]{
36
   int j = i;                   // { dg-warning "shadowed declaration" }
37
   int i;                       // { dg-warning "shadows a lambda capture" }
38
   i = 1;
39
 };
40
}
41
 
42
template 
43
void f4(int i) {
44
 [=]{
45
   int j = i;                   // { dg-warning "shadowed declaration" }
46
   int i;                       // { dg-warning "shadows a lambda capture" }
47
   i = 1;
48
 };
49
}
50
 
51
template void f4(int);

powered by: WebSVN 2.1.0

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