www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19396] New: [betterC] ScopeBuffer can't be used with betterC

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

          Issue ID: 19396
           Summary: [betterC] ScopeBuffer can't be used with betterC with
                    inline
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: radu.racariu gmail.com

std.internal.scopebuffer is a nice utility that can be used when developing for
betterC.

The following
```
import std.internal.scopebuffer;
extern(C):
void main()
{
        ScopeBuffer!char buf;
}

void onOutOfMemoryError(void* pretend_sideffect = null)  trusted pure nothrow
 nogc
{
    assert(false, "Out of memory.");
}
```
Compiled with `-betterC -release  -O -inline` will error out:
```
/dlang/dmd/linux/bin64/../../src/druntime/import/core/exception.d(540): Error:
Cannot use throw statements with -betterC
```

Removing `-inline` makes the error go away.

--
Nov 13 2018