Skip to content

Commit

Permalink
Add unittest for emplace with struct without constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
denis-sh committed Oct 27, 2012
1 parent ca9ef19 commit 4269dd5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions std/conv.d
Expand Up @@ -3608,6 +3608,18 @@ unittest
static assert(!__traits(compiles, emplace!S(&s, 2, 3)));
}

unittest
{
struct S { int a, b = 7; }
S s1 = void, s2 = void;

emplace!S(&s1, 2);
assert(s1.a == 2 && s1.b == 7);

emplace!S(&s2, 2, 3);
assert(s2.a == 2 && s2.b == 3);
}

// Test assignment branch

// FIXME: no tests
Expand Down

0 comments on commit 4269dd5

Please sign in to comment.