gcc/testsuite/g++.dg/coroutines/co-await-syntax-08-lambda-auto.C
raw| 1 | // { dg-additional-options "-fsyntax-only -w" } |
| 2 | |
| 3 | // Check that we decline return type deduction for lambda coroutines. |
| 4 | |
| 5 | #include "coro.h" |
| 6 | |
| 7 | // boiler-plate for tests of codegen |
| 8 | #include "coro1-ret-int-yield-int.h" |
| 9 | |
| 10 | int main () |
| 11 | { |
| 12 | /* Attempt to deduce the return type for a lambda coroutine. */ |
| 13 | auto f = []() |
| 14 | { |
| 15 | co_await coro::suspend_always{}; // { dg-error "cannot be used in a function with a deduced return type" } |
| 16 | }; |
| 17 | |
| 18 | return 0; |
| 19 | } |