D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19105 - Bogus recursive template expansion via getSymbolsByUDA
Summary: Bogus recursive template expansion via getSymbolsByUDA
Status: REOPENED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
Depends on:
Blocks: 340
  Show dependency treegraph
 
Reported: 2018-07-22 06:51 UTC by Abscissa
Modified: 2024-12-13 18:59 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Abscissa 2018-07-22 06:51:46 UTC
---------------------------------------------
module junk;

import std.traits;

struct A(Args...) {}
struct B {}
alias C = A!( getSymbolsByUDA!(junk, B) );
---------------------------------------------

$ dmd junk.d
junk.d(7): Error: template instance `A!(getSymbolsByUDA!(junk, B))` recursive template expansion
junk.d(7): Error: alias `junk.C` recursive alias declaration
Comment 1 Dlang Bot 2019-07-04 13:10:11 UTC
@RazvanN7 created dlang/phobos pull request #7100 "Fix Issue 19105 - Bogus recursive template expansion via getSymbolsByUDA" fixing this issue:

- Fix Issue 19105 - Bogus recursive template expansion via getSymbolsByUDA

https://github.com/dlang/phobos/pull/7100
Comment 2 Dlang Bot 2019-07-10 09:57:44 UTC
dlang/phobos pull request #7100 "Fix Issue 19105 - Bogus recursive template expansion via getSymbolsByUDA" was merged into master:

- 86733d5a4a5379219f04524bead35eff33c6a1a7 by RazvanN7:
  Fix Issue 19105 - Bogus recursive template expansion via getSymbolsByUDA

https://github.com/dlang/phobos/pull/7100
Comment 3 Simen Kjaeraas 2019-07-18 13:21:11 UTC
The "fix" in PR 7100 does nothing to fix the actual issue here - it only prohibits valid use cases, and should very clearly be reverted. See issue 20054.

This issue is a DMD issue, and no amount of Phobos fiddling is gonna fix it. Here's a reduced example:

template test(alias T) {
    alias i = T.C;
    alias test = int;
}

struct A(Args...) {}

struct S1 {
    // No error
    alias dummy = test!S1;
    alias C = A!(test!S1);
}
struct S2 {
    // Recursive template expansion
    alias C = A!(test!S2);
}

As we can see, we're not using the result of T.C, and the simple use of a dummy alias prevents the recursive expansion. Clearly, something is wrong in the compiler for this behavior to happen.
Comment 4 Dlang Bot 2019-08-28 12:02:39 UTC
@Biotronic created dlang/phobos pull request #7158 "Revert "Fix Issue 19105 - Bogus recursive template expansion via getS…" fixing this issue:

- Revert "Fix Issue 19105 - Bogus recursive template expansion via getSymbolsByUDA"
  
  This reverts commit 86733d5a4a5379219f04524bead35eff33c6a1a7.

https://github.com/dlang/phobos/pull/7158
Comment 5 Dlang Bot 2019-12-01 23:40:16 UTC
dlang/phobos pull request #7158 "Revert "Fix Issue 19105 - Bogus recursive template expansion via getS…" was merged into stable:

- f286ee1b2fc65107bd164c0a5b90b1d506f576ab by Simen Kjærås:
  Revert "Fix Issue 19105 - Bogus recursive template expansion via getSymbolsByUDA"
  
  This reverts commit 86733d5a4a5379219f04524bead35eff33c6a1a7.

https://github.com/dlang/phobos/pull/7158
Comment 6 ZombineDev 2019-12-02 11:44:42 UTC
Reopening as per https://issues.dlang.org/show_bug.cgi?id=19105#c3.
Comment 7 Dlang Bot 2019-12-07 15:26:45 UTC
@PetarKirov created dlang/phobos pull request #7309 "Merge stable" fixing this issue:

- Revert "Fix Issue 19105 - Bogus recursive template expansion via getSymbolsByUDA"
  
  This reverts commit 86733d5a4a5379219f04524bead35eff33c6a1a7.

- Merge pull request #7158 from Biotronic/revert-7100
  
  Revert "Fix Issue 19105 - Bogus recursive template expansion via getS…

https://github.com/dlang/phobos/pull/7309
Comment 8 dlangBugzillaToGithub 2024-12-13 18:59:42 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

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

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