[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / test / Analysis / new-dynamic-types.cpp
blobe0a460e3928e3ec68bf2f267c5707e3f4ec771b8
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core -std=c++11 -verify %s
3 // expected-no-diagnostics
5 typedef __typeof(sizeof(int)) size_t;
7 void *operator new(size_t size, void *ptr);
9 struct B {
10 virtual void foo();
13 struct D : public B {
14 virtual void foo() override {}
17 void test_ub() {
18 // FIXME: Potentially warn because this code is pretty weird.
19 B b;
20 new (&b) D;
21 b.foo(); // no-crash
24 void test_non_ub() {
25 char c[sizeof(D)]; // Should be enough storage.
26 new (c) D;
27 ((B *)c)->foo(); // no-crash