D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6848 - typeof(super) does not take into account const/immutable attributes inside member functions
Summary: typeof(super) does not take into account const/immutable attributes inside me...
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, rejects-valid, wrong-code
Depends on:
Blocks: 2573
  Show dependency treegraph
 
Reported: 2011-10-24 22:01 UTC by Kenji Hara
Modified: 2012-04-20 19:14 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 Kenji Hara 2011-10-24 22:01:10 UTC
This is similar to bug 6695.

class Foo {}

class Bar : Foo
{
    void func() immutable {
        pragma(msg, typeof(this));  // immutable(Bar)
        auto t = this;
        pragma(msg, typeof(t));     // immutable(Bar)

        pragma(msg, typeof(super)); // Foo instead of immutable(Foo)
        auto s = super;
        pragma(msg, typeof(s));     // Foo instead of immutable(Foo)
    }
}
Comment 1 SomeDude 2012-04-20 17:03:12 UTC
Output of 2.059 Win32

PS E:\DigitalMars\dmd2\samples> rdmd --main bug.d
immutable(Bar)
immutable(Bar)
immutable(Foo)
immutable(Foo)
PS E:\DigitalMars\dmd2\samples>
Comment 2 Kenji Hara 2012-04-20 19:08:47 UTC
(In reply to comment #1)
> Output of 2.059 Win32
> 
> PS E:\DigitalMars\dmd2\samples> rdmd --main bug.d
> immutable(Bar)
> immutable(Bar)
> immutable(Foo)
> immutable(Foo)
> PS E:\DigitalMars\dmd2\samples>

Thanks for your checking.
May fixed in 2.057.

https://github.com/D-Programming-Language/dmd/pull/475

https://github.com/D-Programming-Language/dmd/commit/85549f10e7904dac18da80b94a0cea2084936542