Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bogus recursive template expansion via getSymbolsByUDA #19461

Open
dlangBugzillaToGithub opened this issue Jul 22, 2018 · 7 comments
Open

Bogus recursive template expansion via getSymbolsByUDA #19461

dlangBugzillaToGithub opened this issue Jul 22, 2018 · 7 comments

Comments

@dlangBugzillaToGithub
Copy link

Abscissa (@Abscissa) reported this on 2018-07-22T06:51:46Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=19105

CC List

  • ZombineDev
  • Simen Kjaeraas
  • JR

Description

---------------------------------------------
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
@dlangBugzillaToGithub
Copy link
Author

dlang-bot commented on 2019-07-04T13:10:11Z

@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

@dlangBugzillaToGithub
Copy link
Author

dlang-bot commented on 2019-07-10T09:57:44Z

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

@dlangBugzillaToGithub
Copy link
Author

simen.kjaras commented on 2019-07-18T13:21:11Z

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.

@dlangBugzillaToGithub
Copy link
Author

dlang-bot commented on 2019-08-28T12:02:39Z

@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

@dlangBugzillaToGithub
Copy link
Author

dlang-bot commented on 2019-12-01T23:40:16Z

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

@dlangBugzillaToGithub
Copy link
Author

petar.p.kirov commented on 2019-12-02T11:44:42Z

Reopening as per https://issues.dlang.org/show_bug.cgi?id=19105#c3.

@dlangBugzillaToGithub
Copy link
Author

dlang-bot commented on 2019-12-07T15:26:45Z

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant