ldc/tests/codegen/attr_weak.d
Johan Engelen 9dc58a76a6 Lit: stop using %T and use %t-dir instead. (#2277)
The %T substitution will be removed from Lit.
Resolves issue #2274
2017-08-17 21:38:35 +02:00

20 lines
581 B
D

// Test linking+running a program with @weak function
// RUN: %ldc -O3 %S/inputs/attr_weak_input.d -c -of=%t-dir/attr_weak_input%obj
// RUN: %ldc -O3 %t-dir/attr_weak_input%obj %s -of=%t%exe
// RUN: %t%exe
import ldc.attributes;
// Should be overridden by attr_weak_input.d (but only because its object
// file is specified before this one for the linker).
// The @weak attribute prevents the optimizer from making any assumptions
// though, so the call below is not inlined.
extern(C) @weak int return_seven() {
return 1;
}
void main() {
assert( return_seven() == 7 );
}