Thread overview
[Issue 21625] Mixed-in unittests can collide with other unittests
Feb 10, 2021
Max Samukha
Feb 10, 2021
Basile-z
Feb 10, 2021
Max Samukha
Feb 10, 2021
Basile-z
Feb 10, 2021
Max Samukha
Dec 17, 2022
Iain Buclaw
February 10, 2021
https://issues.dlang.org/show_bug.cgi?id=21625

--- Comment #1 from Max Samukha <maxsamukha@gmail.com> ---
Same with static constructors:

enum c = q{
static this() {}
};

mixin(c);
static this() {
    assert(false);
}

void main() {
}

--
February 10, 2021
https://issues.dlang.org/show_bug.cgi?id=21625

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp@gmx.com

--- Comment #2 from Basile-z <b2.temp@gmx.com> ---
You say this never runs but I see rather that this does not even compile, ehre I get, using dmd ~master:

/tmp/temp_7FC8FF6B4A50.d-mixin-5:6:1: Error: function `temp_7FC8FF6B4A50.__unittest_L6_C1()` conflicts with previous declaration at /tmp/temp_7FC8FF6B4A50.d:6:1

although this is still a bug.

--
February 10, 2021
https://issues.dlang.org/show_bug.cgi?id=21625

--- Comment #3 from Max Samukha <maxsamukha@gmail.com> ---
I've tried the latest dmd, and it does detect the name conflict.  Older
versions (v2.092.1 in our case) produce runnable binaries (linker warns about
changed symbol size, though).

--
February 10, 2021
https://issues.dlang.org/show_bug.cgi?id=21625

--- Comment #4 from Basile-z <b2.temp@gmx.com> ---
There should not be conflicts. DMD has a special function in its Identifier class that was exactly designed to prevent such conflicts. That's why you see "L" and "C" in the mangle BTW, so definitively a bug.

--
February 10, 2021
https://issues.dlang.org/show_bug.cgi?id=21625

--- Comment #5 from Max Samukha <maxsamukha@gmail.com> ---
(In reply to Basile-z from comment #4)
> There should not be conflicts. DMD has a special function in its Identifier class that was exactly designed to prevent such conflicts. That's why you see "L" and "C" in the mangle BTW, so definitively a bug.

Yes, it's a bug. I was replying to the part where you say that the test case doesn't compile - it indeed doesn't with newer versions of the compiler.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=21625

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
December 13
https://issues.dlang.org/show_bug.cgi?id=21625

--- Comment #6 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19871

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--