void main() { try { } catch(Throwable e) e.toString; } compile with -preview=in -inline: /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(2405): Error: none of the overloads of `toString` are callable using argument types `(void)`, candidates are: /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(2402): `object.Throwable.toString()` /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(2415): `object.Throwable.toString(scope void delegate(in char[]) sink)`
(In reply to Temtaime from comment #0) > void main() > { > try > { > } > catch(Throwable e) > e.toString; > } > > compile with -preview=in -inline: > > /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(2405): Error: none > of the overloads of `toString` are callable using argument types `(void)`, > candidates are: > /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(2402): > `object.Throwable.toString()` > /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(2415): > `object.Throwable.toString(scope void delegate(in char[]) sink)` Well, it's not working for me even when I remove preview=in But my error messages are different(ldc 1.25.0 based on dmd 2.095.1): Error: none of the overloads of this are callable using argument types (), candidates are: /usr/lib/ldc/x86_64-redhat-linux-gnu/include/d/object.d(2140): object.Exception.this(string msg, string file = __FILE__, ulong line = cast(ulong)__LINE__, Throwable nextInChain = null) /usr/lib/ldc/x86_64-redhat-linux-gnu/include/d/object.d(2145): object.Exception.this(string msg, Throwable nextInChain, string file = __FILE__, ulong line = cast(ulong)__LINE__) (whitespace inserted by me) Of course, providing a string argument to Exception solves this, preview=in or otherwise.
(In reply to Tejas_Garhewal from comment #1) > (In reply to Temtaime from comment #0) > > void main() > > { > > try > > { > > } > > catch(Throwable e) > > e.toString; > > } > > > > compile with -preview=in -inline: > > > > /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(2405): Error: none > > of the overloads of `toString` are callable using argument types `(void)`, > > candidates are: > > /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(2402): > > `object.Throwable.toString()` > > /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(2415): > > `object.Throwable.toString(scope void delegate(in char[]) sink)` > > Well, it's not working for me even when I remove preview=in > Oh, and -inline makes no difference for me.
You can try it on https://run.dlang.io/is/w2P2tQ It makes difference, maybe your compiler is outdated / etc
(In reply to Temtaime from comment #3) > You can try it on > https://run.dlang.io/is/w2P2tQ > It makes difference, maybe your compiler is outdated / etc Yeah that error is coming for me on dmd 2.097.1 Maybe regression?
(In reply to Tejas_Garhewal from comment #4) > (In reply to Temtaime from comment #3) > > You can try it on > > https://run.dlang.io/is/w2P2tQ > > It makes difference, maybe your compiler is outdated / etc > > Yeah that error is coming for me on dmd 2.097.1 > > Maybe regression? Sorry, 2.079.2
@Geod24 created dlang/druntime pull request #3592 "[stable] Fix 22283: Weird error in object with inline and preview=in" fixing this issue: - Fix 22283: Weird error in object with inline and preview=in This happens because preview=in uses a 'stronger' version of 'in', which makes 'scope const' and 'in' parameters not covariant. Why it triggers with '-inline' and not without is anyone's guess. https://github.com/dlang/druntime/pull/3592
dlang/druntime pull request #3592 "[stable] Fix 22283: Weird error in object with inline and preview=in" was merged into master: - 096fa3656feece08d2fce6cd018f6bdacf83c175 by Geod24: Fix 22283: Weird error in object with inline and preview=in This happens because preview=in uses a 'stronger' version of 'in', which makes 'scope const' and 'in' parameters not covariant. Why it triggers with '-inline' and not without is anyone's guess. https://github.com/dlang/druntime/pull/3592