Debian Codegraph @

clang/test/SemaCXX/bug135668.cpp

raw
1 // RUN: %clang_cc1 -triple arm64-apple-macosx -Wall -fsyntax-only -verify %s -std=c++26 -fexceptions -fcxx-exceptions
2 // expected-no-diagnostics
3
4 // This test makes sure that we don't erroneously consider an accessible operator
5 // delete to be inaccessible, and then discard the entire new expression.
6
7 class TestClass {
8 public:
9 TestClass();
10 int field = 0;
11 friend class Foo;
12 static void * operator new(unsigned long size);
13 private:
14 static void operator delete(void *p);
15 };
16
17 class Foo {
18 public:
19 int test_method();
20 };
21
22 int Foo::test_method() {
23 TestClass *obj = new TestClass() ;
24 return obj->field;
25 }