d: Merge upstream dmd 47871363d, druntime, c52e28b7, phobos 99e9c1b77.
[official-gcc.git] / gcc / testsuite / gdc.test / compilable / dtoh_AnonDeclaration.d
blob9d686312800f53cb94b60a0ac81f4f91b0221cb1
1 /*
2 REQUIRED_ARGS: -HC -c -o-
3 PERMUTE_ARGS:
4 TEST_OUTPUT:
5 ---
6 // Automatically generated by Digital Mars D Compiler
8 #pragma once
10 #include <assert.h>
11 #include <stddef.h>
12 #include <stdint.h>
13 #include <math.h>
15 #ifdef CUSTOM_D_ARRAY_TYPE
16 #define _d_dynamicArray CUSTOM_D_ARRAY_TYPE
17 #else
18 /// Represents a D [] array
19 template<typename T>
20 struct _d_dynamicArray final
22 size_t length;
23 T *ptr;
25 _d_dynamicArray() : length(0), ptr(NULL) { }
27 _d_dynamicArray(size_t length_in, T *ptr_in)
28 : length(length_in), ptr(ptr_in) { }
30 T& operator[](const size_t idx) {
31 assert(idx < length);
32 return ptr[idx];
35 const T& operator[](const size_t idx) const {
36 assert(idx < length);
37 return ptr[idx];
40 #endif
42 struct S final
44 union
46 int32_t x;
47 char c[4$?:32=u|64=LLU$];
49 struct
51 int32_t y;
52 double z;
53 void bar();
55 struct
57 int32_t outerPrivate;
59 struct
61 int32_t innerPrivate;
62 int32_t innerBar;
64 S()
69 extern void foo();
70 ---
73 extern (C++) struct S
75 union
77 int x;
78 char[4] c;
81 struct
83 int y;
84 double z;
85 extern(C) void foo() {}
86 extern(C++) void bar() {}
89 // Private not emitted because AnonDeclaration has no protection
90 private struct
92 int outerPrivate;
95 public struct {
96 // Private cannot be exported to C++
97 private int innerPrivate;
98 int innerBar;
102 extern (D)
104 extern(C++) void foo() {}