Skip to content

Commit e1321fa

Browse files
committed
Revert "Reapply "[Clang][Sema] placement new initializes typedef array with correct size (#83124)" (#89036)"
This reverts commit 74cab54.
1 parent 36209d3 commit e1321fa

File tree

4 files changed

+2
-47
lines changed

4 files changed

+2
-47
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,6 @@ Bug Fixes to C++ Support
557557
- Fix a crash in requires expression with templated base class member function. Fixes (#GH84020).
558558
- Fix a crash caused by defined struct in a type alias template when the structure
559559
has fields with dependent type. Fixes (#GH75221).
560-
- Fix placement new initializes typedef array with correct size. Fixes (#GH41441).
561560
- Fix the Itanium mangling of lambdas defined in a member of a local class (#GH88906)
562561
- Fixed a crash when trying to evaluate a user-defined ``static_assert`` message whose ``size()``
563562
function returns a large or negative value. Fixes (#GH89407).

clang/lib/Sema/TreeTransform.h

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

12946-
// Per C++0x [expr.new]p5, the type being constructed may be a
12947-
// typedef of an array type.
12948-
QualType AllocType = AllocTypeInfo->getType();
12949-
if (ArraySize && E->isTypeDependent()) {
12950-
if (const ConstantArrayType *Array =
12951-
SemaRef.Context.getAsConstantArrayType(AllocType)) {
12952-
ArraySize = IntegerLiteral::Create(SemaRef.Context, Array->getSize(),
12953-
SemaRef.Context.getSizeType(),
12954-
E->getBeginLoc());
12955-
AllocType = Array->getElementType();
12956-
}
12957-
}
12958-
1295912946
// Transform the placement arguments (if any).
1296012947
bool ArgumentChanged = false;
1296112948
SmallVector<Expr*, 8> PlacementArgs;
@@ -13017,6 +13004,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
1301713004
return E;
1301813005
}
1301913006

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

clang/lib/Serialization/ASTWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5097,7 +5097,7 @@ void ASTWriter::WriteSpecialDeclRecords(Sema &SemaRef) {
50975097
DeclsToCheckForDeferredDiags.push_back(getDeclID(D));
50985098
if (!DeclsToCheckForDeferredDiags.empty())
50995099
Stream.EmitRecord(DECLS_TO_CHECK_FOR_DEFERRED_DIAGS,
5100-
DeclsToCheckForDeferredDiags);
5100+
DeclsToCheckForDeferredDiags);
51015101

51025102
// Write the record containing CUDA-specific declaration references.
51035103
RecordData CUDASpecialDeclRefs;

clang/test/SemaCXX/PR41441.cpp

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

0 commit comments

Comments
 (0)