public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/110959] New: gdc: internal compiler error: in layout_aggregate_type in recursive templated class
@ 2023-08-09 12:51 destructionator at gmail dot com
2023-08-15 15:08 ` [Bug d/110959] " cvs-commit at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: destructionator at gmail dot com @ 2023-08-09 12:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110959
Bug ID: 110959
Summary: gdc: internal compiler error: in layout_aggregate_type
in recursive templated class
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: d
Assignee: ibuclaw at gdcproject dot org
Reporter: destructionator at gmail dot com
Target Milestone: ---
$ gdc --version
gdc (GCC) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gdc gdcbug.d
gdcbug.d: In function ‘D main’:
gdcbug.d:40:23: internal compiler error: in layout_aggregate_type, at
d/types.cc:574
40 | throw ArsdException!"Test"(4, "four");
| ^
0x1bb6f56 internal_error(char const*, ...)
???:0
0x7a967a fancy_abort(char const*, int, char const*)
???:0
0x9bcb03 TypeVisitor::visit(TypeClass*)
???:0
0x9bb8c2 build_ctype(Type*)
???:0
0x9bc056 TypeVisitor::visit(TypeFunction*)
???:0
0x9bb8c2 build_ctype(Type*)
???:0
0x99fa34 get_decl_tree(Declaration*)
???:0
0x9a7e0c ExprVisitor::visit(VarExp*)
???:0
0x9a3b0f build_expr(Expression*, bool, bool)
???:0
0x9a5b13 ExprVisitor::visit(CallExp*)
???:0
0x9a3b0f build_expr(Expression*, bool, bool)
???:0
0x9a3bab build_expr_dtor(Expression*)
???:0
0x9b0250 IRVisitor::visit(ThrowStatement*)
???:0
0x9b0bc8 IRVisitor::visit(ScopeStatement*)
???:0
0x9b08c8 IRVisitor::visit(TryCatchStatement*)
???:0
0x9b016f IRVisitor::visit(CompoundStatement*)
???:0
0x9b016f IRVisitor::visit(CompoundStatement*)
???:0
0x9af85e build_function_body(FuncDeclaration*)
???:0
0x9a320a DeclVisitor::visit(FuncDeclaration*)
???:0
0x99d7c6 build_decl_tree(Dsymbol*)
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ cat gdcbug.d
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);
}
}
}
Iain Buclaw notes the bug seems specific to 12.x, as the reproduction code
works well on gcc 13 and mainline.
/// This example shows how you can throw and catch the ad-hoc exception types.
void main() {
// 0 or 1 args works
try {
throw ArsdException!"Test"(1);
} catch(ArsdException!"Test" e) { // catch it without them
}
// 2 or more args causes ice
try {
throw ArsdException!"Test"(4, "four");
} catch(ArsdException!("Test", int, string) e) { // catch it and use
info by specifying types
assert(e.data[0] == 4); // and extract arguments like this
assert(e.data[1] == "four");
}
}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-15 15:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-09 12:51 [Bug d/110959] New: gdc: internal compiler error: in layout_aggregate_type in recursive templated class destructionator at gmail dot com
2023-08-15 15:08 ` [Bug d/110959] " cvs-commit at gcc dot gnu.org
2023-08-15 15:17 ` cvs-commit at gcc dot gnu.org
2023-08-15 15:18 ` ibuclaw at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).