brintos

brintos / llvm-project-archived public Read only

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