24 lines · cpp
1// RUN: %clang_cl_asan -Od %p/../dll_host.cpp -Fe%t2// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll3// RUN: %run %t %t.dll 2>&1 | FileCheck %s4 5// Test that it works correctly even with ICF enabled.6// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll -link /OPT:REF /OPT:ICF7// RUN: %run %t %t.dll 2>&1 | FileCheck %s8 9#include <iostream>10 11extern "C" __declspec(dllexport)12int test_function() {13 // Just make sure we can use cout.14 std::cout << "All ok\n";15// CHECK: All ok16 17 // This line forces a declaration of some global basic_ostream internal object that18 // calls memcpy() in its constructor. This doesn't work if __asan_init is not19 // called early enough.20 std::cout << 42;21// CHECK: 4222 return 0;23}24