Bug 11584 – std.typecons.Typedef assigned from const

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2013-11-23T12:23:17Z
Last change time
2020-03-21T03:56:36Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2013-11-23T12:23:17Z
import std.typecons: Typedef; void main() { alias T = Typedef!int; immutable T bar; T foo1 = bar; // OK T foo2; foo2 = bar; // Error } dmd 2.065alpha gives: ...\dmd2\src\phobos\std\typecons.d(3853): Error: cannot implicitly convert expression (v) of type immutable(Typedef!(int, 0)) to int test.d(7): Error: template instance std.typecons.Typedef!(int, 0).Typedef.Proxy!(Typedef_payload).opAssign!(Typedef!(int, 0), immutable(Typedef!(int, 0))) error instantiating test.d(7): Error: template std.typecons.Typedef!(int, 0).Typedef.Proxy!(Typedef_payload).opAssign does not match any function template declaration. Candidates are: ...\dmd2\src\phobos\std\typecons.d(3853): std.typecons.Typedef!(int, 0).Typedef.Proxy!(Typedef_payload).opAssign(this X, V)(auto ref V v) if (!is(V == typeof(this))) ...\dmd2\src\phobos\std\typecons.d(3841): std.typecons.Typedef!(int, 0).Typedef.Proxy!(Typedef_payload).opAssign(this X)(auto ref typeof(this) v) test.d(7): Error: template std.typecons.Typedef!(int, 0).Typedef.Proxy!(Typedef_payload).opAssign(this X, V)(auto ref V v) if (!is(V == typeof(this))) cannot deduce template function from argument types !()(immutable(Typedef!(int, 0)))
Comment #1 by bearophile_hugs — 2013-11-23T14:19:53Z
See also Issue 11584
Comment #2 by bearophile_hugs — 2013-11-23T14:20:25Z
(In reply to comment #1) > See also Issue 11584 Sorry, see also Issue 7737
Comment #3 by b2.temp — 2017-12-20T22:37:09Z
fixed. Nothrow-ability is a problem caused by the call to lineSplitter