Richard Smith | 6eb9b9e | 2018-02-03 00:44:57 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify %s |
| 2 | |
| 3 | // FIXME: We could in principle support cases like this (particularly, cases |
| 4 | // where the statement-expression contains no labels). |
| 5 | template <typename... T> void f1() { |
| 6 | int arr[] = { |
| 7 | ({ |
| 8 | T(); // expected-error {{unexpanded parameter pack}} |
| 9 | }) ... // expected-error {{does not contain any unexpanded parameter packs}} |
| 10 | }; |
| 11 | } |
| 12 | |
| 13 | // FIXME: The error for this isn't ideal; it'd be preferable to say that pack |
| 14 | // expansion of a statement expression is not permitted. |
| 15 | template <typename... T> void f2() { |
| 16 | [] { |
| 17 | int arr[] = { |
| 18 | T() + ({ |
| 19 | foo: |
| 20 | T t; // expected-error {{unexpanded parameter pack}} |
| 21 | goto foo; |
| 22 | 0; |
| 23 | }) ... |
| 24 | }; |
| 25 | }; |
| 26 | } |
| 27 | |
| 28 | template <typename... T> void f3() { |
| 29 | ({ |
| 30 | int arr[] = { |
| 31 | [] { |
| 32 | foo: |
| 33 | T t; // OK, expanded within compound statement |
| 34 | goto foo; |
| 35 | return 0; |
| 36 | } ... |
| 37 | }; |
| 38 | }); |
| 39 | } |