[clang] [Clang][AST] Add Test Cases for Reference Qualifiers in Opr Overload (PR #102878)
Muhammad Abdul via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 27 09:23:52 PDT 2024
https://github.com/0xzre updated https://github.com/llvm/llvm-project/pull/102878
>From 11b625354ff05c4384603932e6acca347df2132b Mon Sep 17 00:00:00 2001
From: 0xzre <alilo.ghazali at gmail.com>
Date: Mon, 12 Aug 2024 17:42:37 +0700
Subject: [PATCH 1/2] [Clang][AST] Add Test Cases for Reference Qualifiers in
Operator Overloads
---
clang/test/SemaCXX/function-type-qual.cpp | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/clang/test/SemaCXX/function-type-qual.cpp b/clang/test/SemaCXX/function-type-qual.cpp
index f4906f58abbae0..a46b774dc57e69 100644
--- a/clang/test/SemaCXX/function-type-qual.cpp
+++ b/clang/test/SemaCXX/function-type-qual.cpp
@@ -54,4 +54,18 @@ struct B {
void operator delete(void*) volatile; //expected-error {{static member function cannot have 'volatile' qualifier}}
void operator delete[](void*) volatile; //expected-error {{static member function cannot have 'volatile' qualifier}}
};
+
+struct C {
+ void* operator new(size_t bytes) &; //expected-error {{static member function cannot have '&' qualifier}}
+ void* operator new[](size_t bytes) &; //expected-error {{static member function cannot have '&' qualifier}}
+
+ void* operator new(size_t bytes) &&; //expected-error {{static member function cannot have '&&' qualifier}}
+ void* operator new[](size_t bytes) &&; //expected-error {{static member function cannot have '&&' qualifier}}
+
+ void operator delete(void*) &; //expected-error {{static member function cannot have '&' qualifier}}
+ void operator delete[](void*) &; //expected-error {{static member function cannot have '&' qualifier}}
+
+ void operator delete(void*) &&; //expected-error {{static member function cannot have '&&' qualifier}}
+ void operator delete[](void*) &&; //expected-error {{static member function cannot have '&&' qualifier}}
+};
}
>From cd1b96c5b302ff0c094875b18b9276872679313b Mon Sep 17 00:00:00 2001
From: Muhammad Abdul <alilo.ghazali at gmail.com>
Date: Mon, 12 Aug 2024 19:21:44 +0700
Subject: [PATCH 2/2] Update clang/test/SemaCXX/function-type-qual.cpp
gh issue identifier
Co-authored-by: Yanzuo Liu <zwuis at outlook.com>
---
clang/test/SemaCXX/function-type-qual.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/test/SemaCXX/function-type-qual.cpp b/clang/test/SemaCXX/function-type-qual.cpp
index a46b774dc57e69..c4dcf2a05c92fe 100644
--- a/clang/test/SemaCXX/function-type-qual.cpp
+++ b/clang/test/SemaCXX/function-type-qual.cpp
@@ -55,7 +55,7 @@ struct B {
void operator delete[](void*) volatile; //expected-error {{static member function cannot have 'volatile' qualifier}}
};
-struct C {
+struct GH102422 {
void* operator new(size_t bytes) &; //expected-error {{static member function cannot have '&' qualifier}}
void* operator new[](size_t bytes) &; //expected-error {{static member function cannot have '&' qualifier}}
More information about the cfe-commits
mailing list