Files
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
cmake
docs
include
lib
test
BlocksRuntime
block-static.c
blockimport.c
byrefaccess.c
byrefcopy.c
byrefcopycopy.c
byrefcopyinner.c
byrefcopyint.c
byrefcopystack.c
byrefsanity.c
byrefstruct.c
c99.c
cast.c
constassign.c
copy-block-literal-rdar6439600.c
copyconstructor.C
copynull.c
dispatch_async.c
dispatch_call_Block_with_release.c
fail.c
flagsisa.c
globalexpression.c
goto.c
hasdescriptor.c
josh.C
k-and-r.c
large-struct.c
localisglobal.c
macro.c
makefile
modglobal.c
nestedimport.c
nullblockisa.c
objectRRGC.c
objectassign.c
orbars.c
rdar6396238.c
rdar6405500.c
rdar6414583.c
recursive-block.c
recursive-test.c
recursiveassign.c
reference.C
rettypepromotion.c
returnfunctionptr.c
shorthandexpression.c
sizeof.c
small-struct.c
structmember.c
testfilerunner.h
testfilerunner.m
varargs-bad-assign.c
varargs.c
variadic.c
voidarg.c
asan
builtins
cfi
dfsan
esan
fuzzer
hwasan
interception
lsan
msan
profile
safestack
sanitizer_common
scudo
tsan
ubsan
ubsan_minimal
xray
CMakeLists.txt
lit.common.cfg
lit.common.configured.in
unittests
www
.arcconfig
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
README.txt
eng
libcxx
libcxxabi
libunwind
lld
lldb
llvm
nuget
openmp
polly
Directory.Build.props
Directory.Build.targets
NuGet.config
azure-pipelines.yml
build.cmd
build.sh
dir.common.props
global.json
llvm.proj
mxe-Win64.cmake.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h

46 lines
1.1 KiB
C
Raw Normal View History

//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// -*- mode:C; c-basic-offset:4; tab-width:4; intent-tabs-mode:nil; -*-
// CONFIG
#import <stdio.h>
#import <stdlib.h>
#import <string.h>
typedef struct {
int a;
int b;
} MiniStruct;
int main (int argc, const char * argv[]) {
MiniStruct inny;
MiniStruct outty;
MiniStruct (^copyStruct)(MiniStruct);
memset(&inny, 0xA5, sizeof(inny));
memset(&outty, 0x2A, sizeof(outty));
inny.a = 12;
inny.b = 42;
copyStruct = ^(MiniStruct aTinyStruct){ return aTinyStruct; }; // pass-by-value intrinsically copies the argument
outty = copyStruct(inny);
if ( &inny == &outty ) {
printf("%s: struct wasn't copied.", argv[0]);
exit(1);
}
if ( (inny.a != outty.a) || (inny.b != outty.b) ) {
printf("%s: struct contents did not match.", argv[0]);
exit(1);
}
printf("%s: success\n", argv[0]);
return 0;
}