diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2023-08-15 17:10:45 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2023-08-15 17:16:21 +0200 |
commit | 4acce4c4e53ae93ab8e7dad2ca9099e45559a541 (patch) | |
tree | 38aeff62c021aaa73adabe04b20e088278694123 | |
parent | 84e122c34834d9dea189c10fe0bf60c4d1a99fae (diff) | |
download | gcc-4acce4c4e53ae93ab8e7dad2ca9099e45559a541.zip gcc-4acce4c4e53ae93ab8e7dad2ca9099e45559a541.tar.gz gcc-4acce4c4e53ae93ab8e7dad2ca9099e45559a541.tar.bz2 |
d: Add test case for PR110959.
This ICE is specific to the D front-end language version in GDC 12,
however a test has been added to mainline to catch the unlikely event of
a regression.
PR d/110959
gcc/testsuite/ChangeLog:
* gdc.dg/pr110959.d: New test.
-rw-r--r-- | gcc/testsuite/gdc.dg/pr110959.d | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.dg/pr110959.d b/gcc/testsuite/gdc.dg/pr110959.d new file mode 100644 index 0000000..b1da90f --- /dev/null +++ b/gcc/testsuite/gdc.dg/pr110959.d @@ -0,0 +1,32 @@ +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110959 +// { dg-do compile } +class ArsdExceptionBase : object.Exception { + this(string operation, string file = __FILE__, size_t line = __LINE__, Throwable next = null) { + super(operation, file, line, next); + } +} + +template ArsdException(alias Type, DataTuple...) { + static if(DataTuple.length) + alias Parent = ArsdException!(Type, DataTuple[0 .. $-1]); + else + alias Parent = ArsdExceptionBase; + + class ArsdException : Parent { + DataTuple data; + + this(DataTuple data, string file = __FILE__, size_t line = __LINE__) { + this.data = data; + static if(is(Parent == ArsdExceptionBase)) + super(null, file, line); + else + super(data[0 .. $-1], file, line); + } + + static opCall(R...)(R r, string file = __FILE__, size_t line = __LINE__) { + return new ArsdException!(Type, DataTuple, R)(r, file, line); + } + } +} + +__gshared pr110959 = ArsdException!"Test"(4, "four"); |