Re: gdc ice

2023-08-09 Thread Adam D Ruppe via D.gnu

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110959


Re: gdc ice

2023-08-09 Thread Adam D Ruppe via D.gnu

On Wednesday, 9 August 2023 at 12:44:16 UTC, Iain Buclaw wrote:

Can you raise a bug report against gcc.gnu.org/bugzilla?


yeah i just got the email approving the account a minute ago.

didn't take as long as i thought it would lol


gdc ice

2023-08-09 Thread Adam D Ruppe via D.gnu

$ 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  for instructions.






$ cat gdcbug.d
class ArsdExceptionBase : object.Exception {
package 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);

}
}
}

/// 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");
}
}


Re: Looking to make a GDC-12 mingw64 package

2022-05-21 Thread Adam D Ruppe via D.gnu

On Saturday, 21 May 2022 at 21:18:15 UTC, Chris Piker wrote:
  1. Anyone has built gdc-11 in the mingw64 environment since 
it seems a few patches are required?


No patches are required, it is all upstreamed if you use the 
right settings.


See my comment here:

https://github.com/brechtsanders/winlibs_mingw/issues/48#issuecomment-1044782237


(the maintainer of that repo wants to do binary packages but with 
pthreads, which has some missing headers. should be an easy patch 
but i haven't gotten around to it and i guess iain hasn't yet 
either. but with the configure command i pasted there you can do 
it)


  2. How we might go about creating a pacman package for gdc-12 
since it requires an existing D compiler?


i don't know anything about this.



Re: gdc --version doesn't indicate which D front-end version it's compatible with

2022-01-28 Thread Adam D Ruppe via D.gnu

On Friday, 28 January 2022 at 17:42:25 UTC, singingbush wrote:
It would be far more helpful if running `gdc --version` gave 
some indication of the version of D it's aligned to (which was 
2.076 last time I checked).


It is more complicated than that because gdc has a bunch of 
backported things from newer versions too.


You might be best off just trying it and seeing if your code 
works.


Re: Are there any GDC builds available for Windows?

2021-04-07 Thread Adam D. Ruppe via D.gnu

On Thursday, 8 April 2021 at 02:05:56 UTC, Preetpal wrote:
gdc.exe: fatal error: cannot execute 'd21': CreateProcess: No 
such file or directory

compilation terminated.


The PATH needs to include the normal mingw64 bin path as well as 
the path for gdc.


Though I haven't tried the download here I got mine successfully 
building and running from the same source code..


Re: Remove elements from char[] throws error

2021-03-01 Thread Adam D. Ruppe via D.gnu

On Monday, 1 March 2021 at 17:05:18 UTC, Mark Lagodych wrote:

DMD compiles this fine. But GDC throws the following error:


gdc bundles an older version of the std library, so that 
particular overload was probably added more recently.


You could possibly `cast(ubyte[]) a` in there to select a 
different overload.


Re: Appender example doesn't work with GDC. GDC bug?

2019-12-28 Thread Adam D. Ruppe via D.gnu

On Saturday, 28 December 2019 at 03:08:48 UTC, BoraxMan wrote:
For the line "Writeln(w[]);" GDC reports "error: no [] operator 
overload for type Appender!string".


I think that is just a broken example. Pretty sure it should be 
`w.data` instead of `w[]`.