mirror of
https://github.com/dlang/phobos.git
synced 2025-05-08 20:19:43 +03:00
Fix Issue 12461 - Typedef and opOpAssign
This commit is contained in:
parent
e8a4e9cb74
commit
998ac2bc36
1 changed files with 11 additions and 1 deletions
|
@ -6771,7 +6771,7 @@ mixin template Proxy(alias a)
|
||||||
|
|
||||||
auto ref opOpAssign (string op, this X, V )(auto ref V v)
|
auto ref opOpAssign (string op, this X, V )(auto ref V v)
|
||||||
{
|
{
|
||||||
return mixin("a " ~op~"= v");
|
return mixin("a = a "~op~" v");
|
||||||
}
|
}
|
||||||
auto ref opIndexOpAssign(string op, this X, V, D...)(auto ref V v, auto ref D i)
|
auto ref opIndexOpAssign(string op, this X, V, D...)(auto ref V v, auto ref D i)
|
||||||
{
|
{
|
||||||
|
@ -7480,6 +7480,16 @@ struct Typedef(T, T init = T.init, string cookie=null)
|
||||||
static assert(!is(MoneyEuros == MoneyDollars));
|
static assert(!is(MoneyEuros == MoneyDollars));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// issue 12461
|
||||||
|
@safe unittest
|
||||||
|
{
|
||||||
|
alias Int = Typedef!int;
|
||||||
|
|
||||||
|
Int a, b;
|
||||||
|
a += b;
|
||||||
|
assert(a == 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the underlying type which a `Typedef` wraps.
|
Get the underlying type which a `Typedef` wraps.
|
||||||
If `T` is not a `Typedef` it will alias itself to `T`.
|
If `T` is not a `Typedef` it will alias itself to `T`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue