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)`
Comment #1 by scienticman — 2021-09-07T05:47:57Z
(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.
Comment #2 by scienticman — 2021-09-07T05:50:31Z
(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.
(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?
Comment #5 by scienticman — 2021-09-07T06:11:43Z
(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
Comment #6 by dlang-bot — 2021-10-18T09:44:20Z
@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
Comment #7 by dlang-bot — 2021-10-18T22:30:16Z
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