https://github.com/MitalAshok created
https://github.com/llvm/llvm-project/pull/92814
A new warning -Wdelete-array is issued for the now-accepted delete of an array,
which becomes a pointer to the first element after an array-to-pointer
conversion.
The GNU extension of deleting a void pointer
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Mital Ashok (MitalAshok)
Changes
A new warning -Wdelete-array is issued for the now-accepted delete of an array,
which becomes a pointer to the first element after an array-to-pointer
conversion.
The GNU extension of deleting a void poin
MitalAshok wrote:
The array-to-pointer conversion *is* necessary, even if it's impractical to use:
https://eel.is/c++draft/expr.delete#1.sentence-5
> Otherwise, it shall be a prvalue of pointer to object type.
https://eel.is/c++draft/basic.lval#6
> Whenever a glvalue appears as an operand of
@@ -1230,11 +1230,11 @@ namespace cwg598 { // cwg598: yes
int &t = h(N::i);
}
-namespace cwg599 { // cwg599: partial
+namespace cwg599 { // cwg599: 19
typedef int Fn();
struct S { operator void*(); };
struct T { operator Fn*(); };
- struct U { operator int*(); oper
@@ -1245,12 +1245,7 @@ namespace cwg599 { // cwg599: partial
// expected-error@-1 {{cannot delete expression with pointer-to-'void'
type 'void *'}}
delete t;
// expected-error@-1 {{cannot delete expression of type 'T'}}
-// FIXME: This is valid, but is rejected
@@ -1230,11 +1230,11 @@ namespace cwg598 { // cwg598: yes
int &t = h(N::i);
}
-namespace cwg599 { // cwg599: partial
+namespace cwg599 { // cwg599: 19
typedef int Fn();
struct S { operator void*(); };
struct T { operator Fn*(); };
- struct U { operator int*(); oper
@@ -1245,12 +1245,7 @@ namespace cwg599 { // cwg599: partial
// expected-error@-1 {{cannot delete expression with pointer-to-'void'
type 'void *'}}
delete t;
// expected-error@-1 {{cannot delete expression of type 'T'}}
-// FIXME: This is valid, but is rejected
MitalAshok wrote:
I've also found and fixed a related bug where types were compared with `==` not
`hasSameType`, leading to two conversion operators appearing to be different
when they are the same and Clang not compiling valid code:
https://godbolt.org/z/nY7svGKn8
https://github.com/llvm/llv
https://github.com/MitalAshok updated
https://github.com/llvm/llvm-project/pull/92814
>From 43e9f8fe5cdb19c0f57a00b352592e56e470ffe7 Mon Sep 17 00:00:00 2001
From: Mital Ashok
Date: Mon, 20 May 2024 20:18:48 +0100
Subject: [PATCH 1/2] [Clang] Change how the argument of a delete expression is
c
https://github.com/MitalAshok updated
https://github.com/llvm/llvm-project/pull/92814
>From 43e9f8fe5cdb19c0f57a00b352592e56e470ffe7 Mon Sep 17 00:00:00 2001
From: Mital Ashok
Date: Mon, 20 May 2024 20:18:48 +0100
Subject: [PATCH 1/2] [Clang] Change how the argument of a delete expression is
c
@@ -1230,11 +1230,11 @@ namespace cwg598 { // cwg598: yes
int &t = h(N::i);
}
-namespace cwg599 { // cwg599: partial
+namespace cwg599 { // cwg599: 19
typedef int Fn();
struct S { operator void*(); };
struct T { operator Fn*(); };
- struct U { operator int*(); oper
@@ -1245,12 +1245,7 @@ namespace cwg599 { // cwg599: partial
// expected-error@-1 {{cannot delete expression with pointer-to-'void'
type 'void *'}}
delete t;
// expected-error@-1 {{cannot delete expression of type 'T'}}
-// FIXME: This is valid, but is rejected
https://github.com/MitalAshok updated
https://github.com/llvm/llvm-project/pull/92814
>From 43e9f8fe5cdb19c0f57a00b352592e56e470ffe7 Mon Sep 17 00:00:00 2001
From: Mital Ashok
Date: Mon, 20 May 2024 20:18:48 +0100
Subject: [PATCH 1/3] [Clang] Change how the argument of a delete expression is
c
@@ -1230,11 +1230,11 @@ namespace cwg598 { // cwg598: yes
int &t = h(N::i);
}
-namespace cwg599 { // cwg599: partial
+namespace cwg599 { // cwg599: 19
typedef int Fn();
struct S { operator void*(); };
struct T { operator Fn*(); };
- struct U { operator int*(); oper
https://github.com/MitalAshok updated
https://github.com/llvm/llvm-project/pull/92814
>From 43e9f8fe5cdb19c0f57a00b352592e56e470ffe7 Mon Sep 17 00:00:00 2001
From: Mital Ashok
Date: Mon, 20 May 2024 20:18:48 +0100
Subject: [PATCH 1/3] [Clang] Change how the argument of a delete expression is
c
15 matches
Mail list logo