39 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -fexceptions %s2// expected-no-diagnostics3 4#include "Inputs/cuda.h"5 6__device__ void operator delete(void *p) {}7 8class A {9 int x;10public:11 A() {12 x = 123;13 }14};15 16template<class T>17class shared_ptr {18 T *ptr;19public:20 shared_ptr(T *p) {21 ptr = p;22 }23};24 25// The constructor of B calls the delete operator to clean up26// the memory allocated by the new operator when exceptions happen.27// Make sure that there are no diagnostics due to the device delete28// operator is used.29//30// No need to do similar checks on the device side since it does31// not support exception.32struct B{33 shared_ptr<A> pa{new A};34};35 36int main() {37 B b;38}39