[clang] [Clang][Sema] Fix crash with const qualified member operator new (PR #80327)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 2 03:18:42 PST 2024


================
@@ -37,3 +37,10 @@ void instantiateArrayDecay() {
   int a[1];
   arrayDecay(a);
 }
+
+namespace GH79748 {
+typedef decltype(sizeof(0)) size_t;
+struct A {
+  void* operator new(size_t bytes) const; //expected-error {{static member function cannot have 'const' qualifier}}
----------------
Fznamznon wrote:

Perhaps a test with `volatile` qualifier also makes sense?
Crashes too https://godbolt.org/z/TWr8zqKK1

https://github.com/llvm/llvm-project/pull/80327


More information about the cfe-commits mailing list