Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add test for workaround of 5896.

  • Loading branch information...
commit a9860deaf0ee22142cbc871b9b78a40d91cab616 1 parent 4932c27
@9rnsr authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 typecons/valueproxy.d
View
9 typecons/valueproxy.d
@@ -259,6 +259,8 @@ unittest
const int func(int x, int y){ return x; }
+ T opCast(T)(){ return T.init; }
+
T tempfunc(T)()
{
return T.init;
@@ -301,6 +303,13 @@ unittest
// member function
assert(h.func(2,4) == 2);
+ // bug5896 test
+ assert(h.opCast!int() == 0);
+ assert(cast(int)h == 0);
+ immutable(Hoge) ih = new immutable(Hoge)(new Foo());
+ static assert(!__traits(compiles, ih.opCast!int()));
+ static assert(!__traits(compiles, cast(int)ih));
+
// template member function
assert(h.tempfunc!int() == 0);
}
Please sign in to comment.
Something went wrong with that request. Please try again.