dr1748.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s
  2. // RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s
  3. // RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s
  4. // RUN: %clang_cc1 -std=c++1z %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s
  5. // dr1748: 3.7
  6. // FIXME: __SIZE_TYPE__ expands to 'long long' on some targets.
  7. __extension__ typedef __SIZE_TYPE__ size_t;
  8. void *operator new(size_t, void *);
  9. void *operator new[](size_t, void *);
  10. struct X { X(); };
  11. // The reserved placement allocation functions get inlined
  12. // even if we can't see their definitions. They do not
  13. // perform a null check.
  14. // CHECK-LABEL: define {{.*}} @_Z1fPv(
  15. // CHECK-NOT: call
  16. // CHECK-NOT: icmp{{.*}} null
  17. // CHECK-NOT: br i1
  18. // CHECK: call void @_ZN1XC1Ev(
  19. // CHECK: }
  20. X *f(void *p) { return new (p) X; }
  21. // CHECK-LABEL: define {{.*}} @_Z1gPv(
  22. // CHECK-NOT: call
  23. // CHECK-NOT: icmp{{.*}} null
  24. // CHECK-NOT: br i1
  25. // CHECK: call void @_ZN1XC1Ev(
  26. // CHECK: br i1
  27. // CHECK: }
  28. X *g(void *p) { return new (p) X[5]; }