D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7363 - Eponymous Template doesn't hide internal names in some cases with `static if`
Summary: Eponymous Template doesn't hide internal names in some cases with `static if`
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid, patch, rejects-valid
: 3338 (view as issue list)
Depends on:
Blocks:
 
Reported: 2012-01-24 13:43 UTC by Denis Shelomovskii
Modified: 2012-04-21 05:37 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Denis Shelomovskii 2012-01-24 13:43:06 UTC
It still works sometimes so I decided not to reopen Issue 4675 but create a new one. Testcases:
---
template t() {
    enum e = 0;
    static if (true)
        enum t = 0;
}

static assert(!__traits(compiles, t!().t == 0)); // Assertion fails
static assert(t!() == 0); // Error: void has no value
---
and
---
template t()
{
    static if (true) {
        enum e = 0;
        enum t1 = 0;
    }
    alias t1 t;
}

static assert(!__traits(compiles, t!().t == 0)); // Assertion fails
static assert(t!() == 0); // Error: void has no value
---
Comment 1 Denis Shelomovskii 2012-01-24 14:25:42 UTC
By the way, I'm trying to get rig of Issue 4675 workarounds in Phobos and I hope as soon as it will build without these workarounds, Eponymous Templates will be considered working.
Comment 3 yebblies 2012-02-03 23:42:04 UTC
*** Issue 3338 has been marked as a duplicate of this issue. ***
Comment 4 github-bugzilla 2012-02-09 08:35:01 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/7b3d07aa5041f478b8008cec2428f5ac41015054
Merge pull request #639 from 9rnsr/fix7363

Issue 7363 - Eponymous Template doesn't hide internal names in some cases with `static if`
Comment 5 SomeDude 2012-04-21 05:24:00 UTC
Compiles and runs on 2.059