[cfe-commits] r103909 - in /cfe/trunk: lib/Sema/SemaExprCXX.cpp test/SemaCXX/new-delete.cpp
Anders Carlsson
andersca at mac.com
Sun May 16 09:24:20 PDT 2010
Author: andersca
Date: Sun May 16 11:24:20 2010
New Revision: 103909
URL: http://llvm.org/viewvc/llvm-project?rev=103909&view=rev
Log:
Correctly diagnose array 'new' with initialization arguments when the new type is a typedef to an array type.
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaCXX/new-delete.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=103909&r1=103908&r2=103909&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sun May 16 11:24:20 2010
@@ -760,7 +760,7 @@
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());
Modified: cfe/trunk/test/SemaCXX/new-delete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/new-delete.cpp?rev=103909&r1=103908&r2=103909&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/new-delete.cpp (original)
+++ cfe/trunk/test/SemaCXX/new-delete.cpp Sun May 16 11:24:20 2010
@@ -245,6 +245,9 @@
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>
More information about the cfe-commits
mailing list