blob: 266337634e96522d1fb67065e181302417a1874a [file] [log] [blame]
Richard Smith0e304ea2015-10-22 04:46:14 +00001// RUN: %clang_cc1 -std=c++11 -fcoroutines %s -verify
2
3template<typename T, typename U>
4U f(T t) {
5 co_await t;
6 co_yield t;
7
8 1 + co_await t;
9 1 + co_yield t; // expected-error {{expected expression}}
10
11 auto x = co_await t;
12 auto y = co_yield t;
13
14 for co_await (int x : t) {}
15 for co_await (int x = 0; x != 10; ++x) {} // expected-error {{'co_await' modifier can only be applied to range-based for loop}}
16
17 if (t)
18 co_return t;
19 else
20 co_return {t};
21}