[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / lambda-to-function-pointer-conversion.cpp
blobbe986a4f6eda3abebf5bab134747bbae08c31c01
1 // RUN: %clang_cc1 -triple x86_64-pc-windows-msvc19.0.0 -std=c++11 -emit-llvm -o - %s | FileCheck %s
3 // This code used to cause an assertion failure in EmitDelegateCallArg.
5 // CHECK-LABEL: define internal void @"?__invoke@<lambda_0>@?0??test@@YAXXZ@CA@UTrivial@@@Z"(
6 // CHECK: %unused.capture = alloca %class.anon, align 1
7 // CHECK: call void @"??R<lambda_0>@?0??test@@YAXXZ@QEBA@UTrivial@@@Z"(ptr noundef nonnull align 1 dereferenceable(1) %unused.capture,
9 // CHECK: define internal void @"??R<lambda_0>@?0??test@@YAXXZ@QEBA@UTrivial@@@Z"(ptr noundef nonnull align 1 dereferenceable(1) %this,
11 struct Trivial {
12 int x;
15 void (*fnptr)(Trivial);
17 void test() {
18 fnptr = [](Trivial a){ (void)a; };
21 // CHECK-LABEL: define internal i32 @"?__invoke@<lambda_1>@?0??test2@@YAXXZ@CA@H@Z"(
22 // CHECK: %unused.capture = alloca %class.anon.0, align 1
23 // CHECK: call void @"??R<lambda_1>@?0??test2@@YAXXZ@QEBA@H@Z"(ptr noundef nonnull align 1 dereferenceable(1) %unused.capture,
25 // CHECK: define internal void @"??R<lambda_1>@?0??test2@@YAXXZ@QEBA@H@Z"(ptr noundef nonnull align 1 dereferenceable(1) %this,
27 Trivial (*fnptr2)(int);
29 void test2() {
30 fnptr2 = [](int) -> Trivial { return {}; };