Skip to content

Commit dd84d23

Browse files
committed
Revert "[Clang][Sema] placement new initializes typedef array with correct size (#83124)"
This reverts commit c309dc6. Breaks builds, see discussion in #83124
1 parent dbda478 commit dd84d23

File tree

3 files changed

+1
-34
lines changed

3 files changed

+1
-34
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,6 @@ Bug Fixes to C++ Support
534534
Fixes (#GH70604), (#GH79754), (#GH84163), (#GH84425), (#GH86054), (#GH86398), and (#GH86399).
535535
- Fix a crash when deducing ``auto`` from an invalid dereference (#GH88329).
536536
- Fix a crash in requires expression with templated base class member function. Fixes (#GH84020).
537-
- Placement new initializes typedef array with correct size (#GH41441)
538537

539538
Bug Fixes to AST Handling
540539
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/Sema/TreeTransform.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12864,19 +12864,6 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
1286412864
ArraySize = NewArraySize.get();
1286512865
}
1286612866

12867-
// Per C++0x [expr.new]p5, the type being constructed may be a
12868-
// typedef of an array type.
12869-
QualType AllocType = AllocTypeInfo->getType();
12870-
if (ArraySize) {
12871-
if (const ConstantArrayType *Array =
12872-
SemaRef.Context.getAsConstantArrayType(AllocType)) {
12873-
ArraySize = IntegerLiteral::Create(SemaRef.Context, Array->getSize(),
12874-
SemaRef.Context.getSizeType(),
12875-
E->getBeginLoc());
12876-
AllocType = Array->getElementType();
12877-
}
12878-
}
12879-
1288012867
// Transform the placement arguments (if any).
1288112868
bool ArgumentChanged = false;
1288212869
SmallVector<Expr*, 8> PlacementArgs;
@@ -12938,6 +12925,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
1293812925
return E;
1293912926
}
1294012927

12928+
QualType AllocType = AllocTypeInfo->getType();
1294112929
if (!ArraySize) {
1294212930
// If no array size was specified, but the new expression was
1294312931
// instantiated with an array type (e.g., "new T" where T is

clang/test/SemaCXX/instantiate-new-placement-size.cpp

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)