D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 13333 - Incorrect error ungagging during the resolution of forward references
Summary: Incorrect error ungagging during the resolution of forward references
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
Depends on:
Blocks: 13300
  Show dependency treegraph
 
Reported: 2014-08-19 12:33 UTC by Kenji Hara
Modified: 2014-08-28 04:10 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Kenji Hara 2014-08-19 12:33:30 UTC
By fixing issue 13204, this code should be allowed, but doesn't.

template AliasThisTypeOf(T)
{
    static assert(0, T.stringof);  // T.stringof is important
}

template StaticArrayTypeOf(T)
{
    static if (is(AliasThisTypeOf!T AT))
        alias X = StaticArrayTypeOf!AT;
    else
        alias X = T;

    static if (is(X : E[n], E, size_t n))
        alias StaticArrayTypeOf = X;
    else
        static assert(0, T.stringof~" is not a static array type");
}

enum bool isStaticArray(T) = is(StaticArrayTypeOf!T);

struct VaraiantN(T)
{
    static if (isStaticArray!T)
        ~this() { static assert(0); }
}

struct DummyScope
{
    alias A = VaraiantN!C;

    static class C
    {
        A entity;
    }
}

Blocking issue 13300.
Comment 2 github-bugzilla 2014-08-20 18:27:09 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/5b5945a818aca281844a3c029139abd98c08004d
fix Issue 13333 - Incorrect error ungagging during the resolution of forward references

Improve forward reference resolution in template instantiation with alias

- Check needGagging in TemplateInstance::semantic2()
- Set TemplateInstance::speculative if global.gag is set in semantic()

https://github.com/D-Programming-Language/dmd/commit/78c3fd2965911d191fe05db91ef9d8a5fffd5638
Merge pull request #3878 from 9rnsr/fix13333

Issue 13333 - Incorrect error ungagging during the resolution of forward references
Comment 3 github-bugzilla 2014-08-28 04:10:15 UTC
Commit pushed to 2.066 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9b23adf47fceceafe6b2518092fbbaa041ad962d
Merge pull request #3878 from 9rnsr/fix13333

Issue 13333 - Incorrect error ungagging during the resolution of forward references