llvm-capstone/clang/test/AST/issue53742.cpp
Timm Bäder f8cedc642d [clang] Never wrap a nullptr in CXXNewExpr::getArraySize()
Otherwise callers of these functions have to check both the return value
for and the contents of the returned llvm::Optional.

Fixes #53742

Differential Revision: https://reviews.llvm.org/D119525
2022-02-22 16:27:32 +01:00

15 lines
274 B
C++

// RUN: %clang_cc1 -fsyntax-only %s -verify
struct Data {
char *a;
char *b;
bool *c;
};
int main() {
Data in;
in.a = new char[](); // expected-error {{cannot determine allocated array size from initializer}}
in.c = new bool[100]();
in.b = new char[100]();
}