mirror of
https://review.haiku-os.org/buildtools
synced 2025-02-12 00:37:41 +01:00
Updated dependencies: * GMP 6.2.1 * ISL 0.24 * MPL 1.2.1 * MPFR 4.1.0 The dependencies were pulled in by running the ./contrib/download_prerequisites script and then manually removing the symbolic links and archives, and renaming the directories (i.e mv isl-0.24 to isl)
72 lines
1.5 KiB
D
72 lines
1.5 KiB
D
// { dg-options "-Wno-deprecated" }
|
|
import core.stdc.stdio;
|
|
|
|
// Make sure basic stuff works with future Throwable.message
|
|
class NoMessage : Throwable
|
|
{
|
|
@nogc @safe pure nothrow this(string msg, Throwable next = null)
|
|
{
|
|
super(msg, next);
|
|
}
|
|
}
|
|
|
|
class WithMessage : Throwable
|
|
{
|
|
@nogc @safe pure nothrow this(string msg, Throwable next = null)
|
|
{
|
|
super(msg, next);
|
|
}
|
|
|
|
override const(char)[] message() const
|
|
{
|
|
return "I have a custom message.";
|
|
}
|
|
}
|
|
|
|
class WithMessageNoOverride : Throwable
|
|
{
|
|
@nogc @safe pure nothrow this(string msg, Throwable next = null)
|
|
{
|
|
super(msg, next);
|
|
}
|
|
|
|
const(char)[] message() const
|
|
{
|
|
return "I have a custom message and no override.";
|
|
}
|
|
}
|
|
|
|
class WithMessageNoOverrideAndDifferentSignature : Throwable
|
|
{
|
|
@nogc @safe pure nothrow this(string msg, Throwable next = null)
|
|
{
|
|
super(msg, next);
|
|
}
|
|
|
|
immutable(char)[] message()
|
|
{
|
|
return "I have a custom message and I'm nothing like Throwable.message.";
|
|
}
|
|
}
|
|
|
|
void test(Throwable t)
|
|
{
|
|
try
|
|
{
|
|
throw t;
|
|
}
|
|
catch (Throwable e)
|
|
{
|
|
fprintf(stderr, "%.*s ", cast(int)e.message.length, e.message.ptr);
|
|
}
|
|
}
|
|
|
|
void main()
|
|
{
|
|
test(new NoMessage("exception"));
|
|
test(new WithMessage("exception"));
|
|
test(new WithMessageNoOverride("exception"));
|
|
test(new WithMessageNoOverrideAndDifferentSignature("exception"));
|
|
fprintf(stderr, "\n");
|
|
}
|