mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-07 03:16:05 +03:00
parent
807178d821
commit
e6a18b2657
2 changed files with 32 additions and 0 deletions
|
@ -123,6 +123,17 @@ bool defineAsExternallyAvailable(FuncDeclaration &fdecl) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Because the frontend names `__invariant*` functions differently depending
|
||||
// on the compilation order, we cannot emit the `__invariant` wrapper that
|
||||
// calls the `__invariant*` functions.
|
||||
// This is a workaround, the frontend needs to be changed such that the
|
||||
// __invariant* names no longer depend on semantic analysis order.
|
||||
// See https://github.com/ldc-developers/ldc/issues/1678
|
||||
if (fdecl.isInvariantDeclaration()) {
|
||||
IF_LOG Logger::println("__invariant cannot be emitted.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: Fix inlining functions from object.d. Currently errors because of
|
||||
// TypeInfo type-mismatch issue (TypeInfo classes get special treatment by the
|
||||
// compiler). To start working on it: comment-out this check and druntime will
|
||||
|
|
21
tests/codegen/inlining_invariants_gh1678.d
Normal file
21
tests/codegen/inlining_invariants_gh1678.d
Normal file
|
@ -0,0 +1,21 @@
|
|||
// RUN: %ldc --enable-inlining -of=%t%exe %s
|
||||
|
||||
// https://github.com/ldc-developers/ldc/issues/1678
|
||||
|
||||
import std.datetime;
|
||||
|
||||
// Extra test that fail when a simple frontend change is tried that names __invariant using the line and column number.
|
||||
class A {
|
||||
mixin(genInv("666")); mixin(genInv("777"));
|
||||
}
|
||||
|
||||
string genInv(string a) {
|
||||
return "invariant() { }";
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
auto currentTime = Clock.currTime();
|
||||
auto timeString = currentTime.toISOExtString();
|
||||
auto restoredTime = SysTime.fromISOExtString(timeString);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue