Thread overview
Re: Probably trivial, but VERY frustrating compiler bug
Aug 13, 2020
H. S. Teoh
Aug 13, 2020
Adam D. Ruppe
Aug 13, 2020
H. S. Teoh
Aug 14, 2020
FeepingCreature
August 13, 2020
On Thu, Aug 13, 2020 at 10:20:19PM +0000, Adam D. Ruppe via Digitalmars-d wrote:
> On Thursday, 13 August 2020 at 22:14:15 UTC, H. S. Teoh wrote:
> > In a nutshell: the exact .stringof of certain function symbols changes depending on which overload was processed first.
> 
> wait why the heck is it using .stringof at all? This inside dmd itself? I know it uses mangle toChars in places but the stringof thing should be for user diagnostics only, no internal use.
[...]

Well, Phobos has a unittest in std.format that relies on the exact output of .stringof.

Come to think of it, maybe we should just kill that unittest with fire.
>:-(


T

-- 
He who does not appreciate the beauty of language is not worthy to bemoan its flaws.
August 13, 2020
On Thursday, 13 August 2020 at 22:33:04 UTC, H. S. Teoh wrote:
> Well, Phobos has a unittest in std.format that relies on the exact output of .stringof.

yeah stringof should NEVER be used for anything other than diagnostics intended for a human reader along with other info... its exact format is undefined!

> Come to think of it, maybe we should just kill that unittest with fire.

tbh any unittest that tests specific strings is probably suspect.
August 13, 2020
On Thu, Aug 13, 2020 at 10:43:03PM +0000, Adam D. Ruppe via Digitalmars-d wrote:
> On Thursday, 13 August 2020 at 22:33:04 UTC, H. S. Teoh wrote:
> > Well, Phobos has a unittest in std.format that relies on the exact output of .stringof.
> 
> yeah stringof should NEVER be used for anything other than diagnostics intended for a human reader along with other info... its exact format is undefined!
> 
> > Come to think of it, maybe we should just kill that unittest with fire.
> 
> tbh any unittest that tests specific strings is probably suspect.

I found two unittests that test for exact .stringof format:

std/format.d:2152	assert(to!string(&bar) == "int delegate(short) @nogc delegate() pure nothrow @system");
std/format.d:4802	version (linux) formatTest( &func, "void delegate() @system" );

The second is the one giving me trouble, and already somebody has put in a `version(linux)` hack, presumably it fails in one of the non-linux machines in the auto-tester.

I'm *very* tempted to change that line to "version(none)" right now...


T

-- 
Heads I win, tails you lose.
August 14, 2020
On Thursday, 13 August 2020 at 23:14:41 UTC, H. S. Teoh wrote:
> std/format.d:4802	version (linux) formatTest( &func, "void delegate() @system" );
>
> The second is the one giving me trouble, and already somebody has put in a `version(linux)` hack, presumably it fails in one of the non-linux machines in the auto-tester.
>
> I'm *very* tempted to change that line to "version(none)" right now...
>
>
> T

Just delete it, imo. Let git history serve if people want to look at it. version(none) tests nothing and documents nothing other than "A test was once here."