forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Diagnose use of VLAs in a coroutine (llvm#70341)
Fixes llvm#65858
- Loading branch information
1 parent
a7d6039
commit 09e8ef9
Showing
6 changed files
with
60 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -Wno-vla-cxx-extension -verify | ||
#include "Inputs/std-coroutine.h" | ||
|
||
struct promise; | ||
|
||
struct coroutine : std::coroutine_handle<promise> { | ||
using promise_type = ::promise; | ||
}; | ||
|
||
struct promise | ||
{ | ||
coroutine get_return_object(); | ||
std::suspend_always initial_suspend() noexcept; | ||
std::suspend_always final_suspend() noexcept; | ||
void return_void(); | ||
void unhandled_exception(); | ||
}; | ||
|
||
coroutine foo(int n) { | ||
int array[n]; // expected-error {{variable length arrays in a coroutine are not supported}} | ||
co_return; | ||
} | ||
|
||
void lambda() { | ||
[](int n) -> coroutine { | ||
int array[n]; // expected-error {{variable length arrays in a coroutine are not supported}} | ||
co_return; | ||
}(10); | ||
} |