ldc/tests/codegen/pragma_LDC_extern_weak.d
Johan Engelen 0a84988d65
Enable pragma(LDC_extern_weak) on function declarations. (#2984)
Enable pragma(LDC_extern_weak) on function declarations.
2019-01-27 14:44:31 +01:00

21 lines
624 B
D

// Test pragma(LDC_extern_weak) on function declarations.
// RUN: %ldc -d-version=DECLARATION -c -output-ll -of=%t.ll %s && FileCheck %s < %t.ll --check-prefix=DECLARATION
// RUN: not %ldc -d-version=DEFINITION %s 2>&1 | FileCheck %s --check-prefix=DEFINITION
version(DECLARATION)
{
// DECLARATION: declare{{.*}} extern_weak {{.*}}weakreffunction
pragma(LDC_extern_weak) extern(C) void weakreffunction();
}
version(DEFINITION)
{
// DEFINITION: Error: `LDC_extern_weak` cannot be applied to function definitions
pragma(LDC_extern_weak) extern(C) void weakreffunction() {};
}
void foo()
{
auto a = &weakreffunction;
}