view clang/test/Analysis/placement-new-user-defined.cpp @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 1d019706d866
children
line wrap: on
line source

// RUN: %clang_analyze_cc1 -std=c++11 %s \
// RUN:   -analyzer-checker=core \
// RUN:   -analyzer-checker=cplusplus.NewDelete \
// RUN:   -analyzer-checker=cplusplus.PlacementNew \
// RUN:   -analyzer-output=text -verify \
// RUN:   -triple x86_64-unknown-linux-gnu

// expected-no-diagnostics

#include "Inputs/system-header-simulator-cxx.h"

struct X {
  static void *operator new(std::size_t sz, void *b) {
    return ::operator new(sz, b);
  }
  long l;
};
void f() {
  short buf;
  X *p1 = new (&buf) X;
  (void)p1;
}