File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -850,12 +850,14 @@ CodeGenTypes::getCGRecordLayout(const RecordDecl *RD) {
850
850
}
851
851
852
852
bool CodeGenTypes::isPointerZeroInitializable (QualType T) {
853
- assert ((T->isAnyPointerType () || T->isBlockPointerType ()) && " Invalid type" );
853
+ assert ((T->isAnyPointerType () || T->isBlockPointerType () ||
854
+ T->isNullPtrType ()) &&
855
+ " Invalid type" );
854
856
return isZeroInitializable (T);
855
857
}
856
858
857
859
bool CodeGenTypes::isZeroInitializable (QualType T) {
858
- if (T->getAs <PointerType>())
860
+ if (T->getAs <PointerType>() || T-> isNullPtrType () )
859
861
return Context.getTargetNullPointerValue (T) == 0 ;
860
862
861
863
if (const auto *AT = Context.getAsArrayType (T)) {
Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 -std=c++20 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
2
+
3
+ using ulong = unsigned long ;
4
+ template <class ... Ts>
5
+ void g (Ts... args) {
6
+ ulong arr[3 ] = {ulong (args)...};
7
+ (void )arr;
8
+ }
9
+ extern void f () {
10
+ g (nullptr , 17 );
11
+ }
12
+
13
+ // CHECK: {{^}} store i64 0, ptr %arr, align 8{{$}}
You can’t perform that action at this time.
0 commit comments