Issue 6360 - @property is doubled in di files when used with auto
Summary: @property is doubled in di files when used with auto
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: patch
Depends on:
Blocks:
 
Reported: 2011-07-21 22:11 UTC by Jonathan M Davis
Modified: 2015-06-09 05:15 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 Jonathan M Davis 2011-07-21 22:11:41 UTC
As an example, take any property in core.time - say

    @property long weeks() const pure nothrow { return get!"weeks"(); }

Now make it return auto instead of long. Rebuild druntime, and time.di will have this for weeks:

        auto @property const pure nothrow @property  weeks()
{
return get!("weeks")();
}

Notice that @property is doubled. This will cause compilation errors for Phobos such as

../druntime/import/core/time.di(136): redundant storage class identifier

However, if you change it back to long, you get

        @property const pure nothrow long weeks()
{
return get!("weeks")();
}


So, @property and auto are not getting along when .di files are generated.