mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 13:40:20 +03:00
Merge pull request #6764 from rracariu/master
Fix Issue 19396 - ScopeBuffer can't be used in betterC with inline merged-on-behalf-of: Petar Kirov <ZombineDev@users.noreply.github.com>
This commit is contained in:
commit
a66435ea90
1 changed files with 6 additions and 5 deletions
|
@ -12,6 +12,7 @@ module std.internal.scopebuffer;
|
||||||
|
|
||||||
import core.stdc.stdlib : realloc;
|
import core.stdc.stdlib : realloc;
|
||||||
import std.traits;
|
import std.traits;
|
||||||
|
import std.internal.attributes : betterC;
|
||||||
|
|
||||||
/**************************************
|
/**************************************
|
||||||
* ScopeBuffer encapsulates using a local array as a temporary buffer.
|
* ScopeBuffer encapsulates using a local array as a temporary buffer.
|
||||||
|
@ -128,7 +129,7 @@ if (isAssignable!T &&
|
||||||
this.bufLen = cast(uint) buf.length;
|
this.bufLen = cast(uint) buf.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@system unittest
|
@system @betterC unittest
|
||||||
{
|
{
|
||||||
ubyte[10] tmpbuf = void;
|
ubyte[10] tmpbuf = void;
|
||||||
auto sbuf = ScopeBuffer!ubyte(tmpbuf);
|
auto sbuf = ScopeBuffer!ubyte(tmpbuf);
|
||||||
|
@ -289,7 +290,7 @@ if (isAssignable!T &&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@system unittest
|
@system @betterC unittest
|
||||||
{
|
{
|
||||||
import core.stdc.stdio;
|
import core.stdc.stdio;
|
||||||
import std.range;
|
import std.range;
|
||||||
|
@ -350,7 +351,7 @@ if (isAssignable!T &&
|
||||||
}
|
}
|
||||||
|
|
||||||
// const
|
// const
|
||||||
@system unittest
|
@system @betterC unittest
|
||||||
{
|
{
|
||||||
char[10] tmpbuf = void;
|
char[10] tmpbuf = void;
|
||||||
auto textbuf = ScopeBuffer!char(tmpbuf);
|
auto textbuf = ScopeBuffer!char(tmpbuf);
|
||||||
|
@ -377,14 +378,14 @@ auto scopeBuffer(T)(T[] tmpbuf)
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@system unittest
|
@system @betterC unittest
|
||||||
{
|
{
|
||||||
ubyte[10] tmpbuf = void;
|
ubyte[10] tmpbuf = void;
|
||||||
auto sb = scopeBuffer(tmpbuf);
|
auto sb = scopeBuffer(tmpbuf);
|
||||||
scope(exit) sb.free();
|
scope(exit) sb.free();
|
||||||
}
|
}
|
||||||
|
|
||||||
@system unittest
|
@system @betterC unittest
|
||||||
{
|
{
|
||||||
ScopeBuffer!(int*) b;
|
ScopeBuffer!(int*) b;
|
||||||
int*[] s;
|
int*[] s;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue