D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21640 - @live not working with templates
Summary: @live not working with templates
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2021-02-15 22:53 UTC by João Lourenço
Modified: 2021-02-16 03:01 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description João Lourenço 2021-02-15 22:53:17 UTC
@live void alloc(T)()
{
    auto p = malloc(4);
} // should not compile with the error: variable `alloc(T).p` is left dangling at return

void main() {}
Comment 1 Dlang Bot 2021-02-16 02:11:42 UTC
@ljmf00 created dlang/dmd pull request #12197 "Fix issue #21640: @live not working with templates" fixing this issue:

- Fix issue #21640: @live not working with templates
  
  Signed-off-by: Luís Ferreira <contact@lsferreira.net>

https://github.com/dlang/dmd/pull/12197
Comment 2 Mathias LANG 2021-02-16 02:28:51 UTC
Side note: That example is broken (aka not http://sscce.org/ ), aside from the lack of import leading to undefined identifier `malloc`, the template isn't instantiated. But the PR has correct examples.
Comment 3 Dlang Bot 2021-02-16 03:01:29 UTC
dlang/dmd pull request #12197 "Fix issue #21640: @live not working with templates" was merged into master:

- f0da66d55a73d7271000b7f04fe1ad6d83ca1ef3 by Luís Ferreira:
  Fix issue #21640: @live not working with templates
  
  Signed-off-by: Luís Ferreira <contact@lsferreira.net>

https://github.com/dlang/dmd/pull/12197