Add support for dmd 2.076.0
This commit is contained in:
		| @@ -7,6 +7,7 @@ os: | ||||
| language: d | ||||
|  | ||||
| d: | ||||
|   - dmd-2.076.0 | ||||
|   - dmd-2.075.1 | ||||
|   - dmd-2.074.1 | ||||
|   - dmd-2.073.2 | ||||
| @@ -22,7 +23,7 @@ addons: | ||||
|       - gcc-multilib | ||||
|  | ||||
| before_script: | ||||
|   - if [ "$PS1" = '(dmd-2.075.1)' ]; then | ||||
|   - if [ "$PS1" = '(dmd-2.076.0)' ]; then | ||||
|       export UNITTEST="unittest-cov"; | ||||
|     fi | ||||
|  | ||||
|   | ||||
| @@ -3,6 +3,12 @@ os: Visual Studio 2015 | ||||
|  | ||||
| environment: | ||||
|   matrix: | ||||
|     - DC: dmd | ||||
|       DVersion: 2.076.0 | ||||
|       arch: x64 | ||||
|     - DC: dmd | ||||
|       DVersion: 2.076.0 | ||||
|       arch: x86 | ||||
|     - DC: dmd | ||||
|       DVersion: 2.075.1 | ||||
|       arch: x64 | ||||
|   | ||||
| @@ -209,6 +209,23 @@ pure nothrow @safe @nogc unittest | ||||
|     static assert(sizeOf!(void[16]) == 16); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Returns the alignment of the type $(D_PARAM T). | ||||
|  * | ||||
|  * Params: | ||||
|  *  T = A type. | ||||
|  * | ||||
|  * Returns: Alignment of the type $(D_PARAM T). | ||||
|  */ | ||||
| enum size_t alignOf(T) = T.alignof; | ||||
|  | ||||
| /// | ||||
| pure nothrow @safe @nogc unittest | ||||
| { | ||||
|     static assert(alignOf!bool == bool.alignof); | ||||
|     static assert(is(typeof(alignOf!bool) == typeof(bool.alignof))); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Tests whether $(D_INLINECODE Args[0]) and $(D_INLINECODE Args[1]) are the | ||||
|  * same symbol. | ||||
| @@ -396,7 +413,8 @@ version (TanyaPhobos) | ||||
|                                hasElaborateDestructor, | ||||
|                                hasElaborateCopyConstructor, | ||||
|                                hasElaborateAssign, | ||||
|                                EnumMembers; | ||||
|                                EnumMembers, | ||||
|                                classInstanceAlignment; | ||||
| } | ||||
| else: | ||||
|  | ||||
| @@ -2627,3 +2645,43 @@ pure nothrow @nogc @safe unittest | ||||
|     } | ||||
|     static assert([E.one, E.two, E.three] == [ EnumMembers!E ]); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Different than $(D_INLINECODE T.alignof), which is the same for all class | ||||
|  * types,  $(D_PSYMBOL classInstanceOf) determines the alignment of the class | ||||
|  * instance and not of its reference. | ||||
|  * | ||||
|  * Params: | ||||
|  *  T = A class. | ||||
|  * | ||||
|  * Returns: Alignment of an instance of the class $(D_PARAM T). | ||||
|  */ | ||||
| template classInstanceAlignment(T) | ||||
| if (is(T == class)) | ||||
| { | ||||
|     private enum ptrdiff_t pred(U1, U2) = U1.alignof - U2.alignof; | ||||
|     private alias Fields = typeof(T.tupleof); | ||||
|     enum size_t classInstanceAlignment = Max!(pred, T, Fields).alignof; | ||||
| } | ||||
|  | ||||
| /// | ||||
| pure nothrow @safe @nogc unittest | ||||
| { | ||||
|     class C1 | ||||
|     { | ||||
|     } | ||||
|     static assert(classInstanceAlignment!C1 == C1.alignof); | ||||
|  | ||||
|     struct S | ||||
|     { | ||||
|         align(8) | ||||
|         uint s; | ||||
|  | ||||
|         int i; | ||||
|     } | ||||
|     class C2 | ||||
|     { | ||||
|         S s; | ||||
|     } | ||||
|     static assert(classInstanceAlignment!C2 == S.alignof); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user