1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2
f()3 void f() {
4 int b;
5 int arr[] = {1, 2, 3};
6
7 if (bool b = true) // expected-note 2{{previous definition}}
8 bool b; // expected-error {{redefinition}}
9 else
10 int b; // expected-error {{redefinition}}
11 while (bool b = true) // expected-note {{previous definition}}
12 int b; // expected-error {{redefinition}}
13 for (int c; // expected-note 2{{previous definition}}
14 bool c = true;) // expected-error {{redefinition}}
15 double c; // expected-error {{redefinition}}
16 switch (int n = 37 + 5) // expected-note {{previous definition}}
17 int n; // expected-error {{redefinition}}
18 for (int a : arr) // expected-note {{previous definition}}
19 int a = 0; // expected-error {{redefinition}}
20
21 if (bool b = true) { // expected-note 2{{previous definition}}
22 int b; // expected-error {{redefinition}}
23 } else {
24 int b; // expected-error {{redefinition}}
25 }
26 while (bool b = true) { // expected-note {{previous definition}}
27 int b; // expected-error {{redefinition}}
28 }
29 for (int c; // expected-note 2{{previous definition}}
30 bool c = true;) { // expected-error {{redefinition}}
31 double c; // expected-error {{redefinition}}
32 }
33 switch (int n = 37 + 5) { // expected-note {{previous definition}}
34 int n; // expected-error {{redefinition}}
35 }
36 for (int &a : arr) { // expected-note {{previous definition}}
37 int a = 0; // expected-error {{redefinition}}
38 }
39
40 if (bool b = true) {{ // expected-note {{previous definition}}
41 bool b;
42 }} else {
43 int b; // expected-error {{redefinition}}
44 }
45 if (bool b = true) { // expected-note {{previous definition}}
46 bool b; // expected-error {{redefinition}}
47 } else {{
48 int b;
49 }}
50 if (bool b = true) {{
51 bool b;
52 }} else {{
53 int b;
54 }}
55 while (bool b = true) {{
56 int b;
57 }}
58 for (int c; // expected-note {{previous definition}}
59 bool c = true; ) {{ // expected-error {{redefinition}}
60 double c;
61 }}
62 switch (int n = 37 + 5) {{
63 int n;
64 }}
65 for (int &a : arr) {{
66 int a = 0;
67 }}
68 }
69