view clang/test/Analysis/new-aligned.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++17 -analyze -analyzer-checker=core -verify %s

// expected-no-diagnostics

// Notice the weird alignment.
struct alignas(1024) S {};

void foo() {
  // Operator new() here is the C++17 aligned new that takes two arguments:
  // size and alignment. Size is passed implicitly as usual, and alignment
  // is passed implicitly in a similar manner.
  S *s = new S; // no-warning
  delete s;
}