Bug 10884 – Support for using alias expressions to shorten inferred function types

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-08-24T10:59:03Z
Last change time
2020-12-24T02:31:10Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
bearophile_hugs
See also
https://issues.dlang.org/show_bug.cgi?id=1807

Comments

Comment #0 by bearophile_hugs — 2013-08-24T10:59:03Z
I tagged this as enhancement but I consider it as borderline bug report: struct Foo(T) { T x; } void bar1(T)(Foo!T c) {} alias F(T) = Foo!T; void bar2(T)(F!T c) {} // line 4, error void main() { F!int x = Foo!int(1); bar1(x); // OK bar2(x); // line 8, error } dmd 2.064alpha: test.d(8): Error: template test.bar2 does not match any function template declaration. Candidates are: test.d(4): test.bar2(T)(F!T c) test.d(8): Error: template test.bar2(T)(F!T c) cannot deduce template function from argument types !()(Foo!int) Support for similar code is handy to use alias expressions to shorten code when the same complex type is used in many function signatures, like in bar2.
Comment #1 by ag0aep6g — 2018-04-17T16:07:11Z
*** Issue 18769 has been marked as a duplicate of this issue. ***
Comment #2 by ag0aep6g — 2018-04-17T16:08:26Z
*** Issue 16486 has been marked as a duplicate of this issue. ***
Comment #3 by ag0aep6g — 2018-04-17T16:09:10Z
*** Issue 13090 has been marked as a duplicate of this issue. ***
Comment #4 by ag0aep6g — 2018-04-17T16:10:31Z
*** Issue 11452 has been marked as a duplicate of this issue. ***
Comment #5 by ag0aep6g — 2018-04-17T16:16:46Z
*** This issue has been marked as a duplicate of issue 1807 ***