forked from OSchip/llvm-project
Correctly diagnose array 'new' with initialization arguments when the new type is a typedef to an array type.
llvm-svn: 103909
This commit is contained in:
parent
cda95f47e5
commit
e6ae81b0a2
|
@ -760,7 +760,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal,
|
|||
ASTOwningVector<&ActionBase::DeleteExpr> ConvertedConstructorArgs(*this);
|
||||
|
||||
// Array 'new' can't have any initializers.
|
||||
if (NumConsArgs && ArraySize) {
|
||||
if (NumConsArgs && (ResultType->isArrayType() || ArraySize)) {
|
||||
SourceRange InitRange(ConsArgs[0]->getLocStart(),
|
||||
ConsArgs[NumConsArgs - 1]->getLocEnd());
|
||||
|
||||
|
|
|
@ -245,6 +245,9 @@ namespace Test1 {
|
|||
|
||||
void f() {
|
||||
(void)new int[10](1, 2); // expected-error {{array 'new' cannot have initialization arguments}}
|
||||
|
||||
typedef int T[10];
|
||||
(void)new T(1, 2); // expected-error {{array 'new' cannot have initialization arguments}}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
Loading…
Reference in New Issue