mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 17:11:44 +03:00
20 lines
581 B
D
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 );
|
|
}
|