brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1000 B · 7a6260f Raw
47 lines · cpp
1// RUN: %clang --target=x86_64-pc-linux -S -fno-discard-value-names -emit-llvm -o - %s | FileCheck %s2// RUN: %clang_cc1 %s -fsyntax-only -verify3 4namespace std {5  using size_t = decltype(sizeof(int));6};7void* operator new[](std::size_t, void*) noexcept;8 9// CHECK: call void @llvm.memset.p0.i64(ptr align 1 %x, i8 0, i64 8, i1 false)10// CHECK: call void @llvm.memset.p0.i64(ptr align 16 %x, i8 0, i64 32, i1 false)11template <typename TYPE>12void f()13{14    typedef TYPE TArray[8];15 16    TArray x;17    new(&x) TArray();18}19 20template <typename T>21void f1() {22  int (*x)[1] = new int[1][1];23}24template void f1<char>();25void f2() {26  int (*x)[1] = new int[1][1];27}28 29int main()30{31    f<char>();32    f<int>();33}34 35// expected-no-diagnostics36template <typename T> struct unique_ptr {unique_ptr(T* p){}};37 38template <typename T>39unique_ptr<T> make_unique(unsigned long long n) {40  return unique_ptr<T>(new T[n]());41}42 43auto boro(int n){44	typedef double HistoryBuffer[4];45	return make_unique<HistoryBuffer>(n);46}47