[Issue 21837] Emplace depends on exceptions?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 7 14:19:58 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21837

Eduard Staniloiu <edi33416 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |edi33416 at gmail.com

--- Comment #2 from Eduard Staniloiu <edi33416 at gmail.com> ---
Can you please provide a minimal snippet that reproduces your error?
I cannot access the repo provided.

I've tested the snippet below with the latest druntime
(4f6a249dedbba2fa556ec7a4e642188f0d7bec7f) and it doesn't reproduce the
reported issue.

```
{
  struct S                                                                      
  {                                                                             
    int i;                                                                      
    this(S other) { assert(false); }                                            
    this(int i) { this.i = i; }                                                 
  }                                                                             

  S a;                                                                          
  auto b = S(5);                                                                
  emplace(&a, b);                                                               

  assert(a.i == 5);
}
```

emplace() and emplaceRef() can be used within -betterC code.

--


More information about the Digitalmars-d-bugs mailing list