// This worked on dmd <= 2.088.1
mixin Bug!"asd";
enum test;
template Bug(string n)
{
int main()
{
import std;
foreach(name; __traits(allMembers, __traits(parent, main)))
static if (hasUDA!(__traits(getMember, __traits(parent, main), name), test))
return 0;
return 0;
}
}
Comment #1 by trikkuz — 2019-11-08T09:37:28Z
Digger:
digger: 36ccf092ed154a15700c2d082795bcc1ea1b8f99 is the first bad commit
commit 36ccf092ed154a15700c2d082795bcc1ea1b8f99
Author: The Dlang Bot <[email protected]>
Date: Mon Aug 26 12:33:40 2019 +0200
dmd: Merge pull request #10351 from JinShil/entry
https://github.com/dlang/dmd/pull/10351
Move hard-coded logic to generate C main out of the compiler and into druntime
merged-on-behalf-of: Nicholas Wilson <[email protected]>
diff --git a/dmd b/dmd
index 0de452558..a01aa5587 160000
The `main` in `core/internal/entrypoint.d` and the `main` created by the user in their module results in an `OverloadSet`. When the user invokes `__traits(getMember, usersModule, "main")` the overload set is returned which evaluates to `void`.
Working on a fix at https://github.com/dlang/druntime/pull/2861, but I'm not sure if it will work.
Comment #5 by dlang-bot — 2022-03-24T11:35:40Z
@MoonlightSentinel created dlang/druntime pull request #3786 "Fix 20368 - Remove name conflict for `main` mixin" fixing this issue:
- Fix 20368 - Remove name conflict for `main` mixin
Use a unique name with override mangle s.t. it doesn't conflict with the
user-defined main.
Co-authored-by: JinShil <[email protected]>
Co-authored-by: Ernesto Castellotti <[email protected]>
(see PR's 2861 and 2953)
https://github.com/dlang/druntime/pull/3786
Comment #6 by robert.schadek — 2024-12-07T13:39:49Z