Skip to content

Commit

Permalink
Improve emplace unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
denis-sh committed Oct 27, 2012
1 parent 10375d6 commit ca9ef19
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions std/conv.d
Expand Up @@ -3595,14 +3595,17 @@ unittest

unittest
{
struct Foo
{
uint num;
}
struct S { uint n; }
S s;
emplace!S(&s, 2U);
assert(s.n == 2);
}

Foo foo;
emplace!Foo(&foo, 2U);
assert(foo.num == 2);
unittest
{
struct S { int a, b; this(int){} }
S s;
static assert(!__traits(compiles, emplace!S(&s, 2, 3)));
}

// Test assignment branch
Expand Down

0 comments on commit ca9ef19

Please sign in to comment.