D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 12425 - allow default values for "auto ref"
Summary: allow default values for "auto ref"
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-20 09:29 UTC by Vladimir Panteleev
Modified: 2020-03-21 03:56 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 Vladimir Panteleev 2014-03-20 09:29:40 UTC
E.g.: void foo(T)(auto ref T t = 5)

The parameter becomes a reference if the default expression is an lvalue (e.g. *new int(5)).
Comment 1 bearophile_hugs 2014-03-20 09:36:39 UTC
This was allowed, and it was "recently" disallowed.
Comment 2 basile-z 2020-02-20 16:15:00 UTC
since 2.087.0