Richard Smith | c7a05a9 | 2016-06-29 21:17:59 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -std=c++1z -verify %s -Wno-vexing-parse |
| 2 | |
| 3 | int g, h; |
| 4 | typedef int T; |
| 5 | int f() { |
| 6 | // init-statement declarations |
| 7 | if (T n = 0; n != 0) {} // expected-error {{not yet supported}} |
| 8 | if (T f(); f()) {} // expected-error {{not yet supported}} |
| 9 | if (T(f()); f()) {} // expected-error {{not yet supported}} |
| 10 | if (T(f()), g, h; f()) {} // expected-error {{not yet supported}} |
| 11 | if (T f(); f()) {} // expected-error {{not yet supported}} |
| 12 | if (T f(), g, h; f()) {} // expected-error {{not yet supported}} |
| 13 | |
| 14 | // init-statement expressions |
| 15 | if (T{f()}; f()) {} // expected-error {{not yet supported}} |
| 16 | if (T{f()}, g, h; f()) {} // expected-error {{not yet supported}} expected-warning 2{{unused}} |
| 17 | if (T(f()), g, h + 1; f()) {} // expected-error {{not yet supported}} expected-warning 2{{unused}} |
| 18 | |
| 19 | // condition declarations |
| 20 | if (T(n){g}) {} |
| 21 | if (T f()) {} // expected-error {{function type}} |
| 22 | if (T f(), g, h) {} // expected-error {{function type}} |
| 23 | |
| 24 | // condition expressions |
| 25 | if (T(f())) {} |
| 26 | if (T{f()}) {} |
| 27 | if (T(f()), g, h) {} // expected-warning 2{{unused}} |
| 28 | if (T{f()}, g, h) {} // expected-warning 2{{unused}} |
| 29 | |
| 30 | // none of the above |
| 31 | // FIXME: This causes a typo-correction crash, as does "void f() { +T(n)(g); }" |
| 32 | //if (T(n)(g)) {} // expected-err-FIXME {{not a function}} |
| 33 | |
| 34 | // Likewise for 'switch' |
| 35 | switch (int n; n) {} // expected-error {{not yet supported}} |
| 36 | switch (g; int g = 5) {} // expected-error {{not yet supported}} |
| 37 | |
| 38 | if (int a, b; int c = a) { // expected-error {{not yet supported}} expected-note 6{{previous}} |
| 39 | int a; // expected-error {{redefinition}} |
| 40 | int b; // expected-error {{redefinition}} |
| 41 | int c; // expected-error {{redefinition}} |
| 42 | } else { |
| 43 | int a; // expected-error {{redefinition}} |
| 44 | int b; // expected-error {{redefinition}} |
| 45 | int c; // expected-error {{redefinition}} |
| 46 | } |
| 47 | } |