d: Merge upstream dmd, druntime 26f049fb26, phobos 330d6a4fd.
[official-gcc.git] / gcc / testsuite / gdc.test / compilable / dtoh_21217.d
blob3e535d24a06cd261b25fd2e33e86452a793a1430
1 /*
2 REQUIRED_ARGS: -HC=verbose -c -o-
3 PERMUTE_ARGS:
4 TEST_OUTPUT:
5 ---
6 // Automatically generated by Digital Mars D Compiler v$n$
8 #pragma once
10 #include <assert.h>
11 #include <math.h>
12 #include <stddef.h>
13 #include <stdint.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 Foo final
44 int32_t a;
45 enum : int32_t { b = 2 };
47 // Ignored enum `dtoh_21217.Foo.c` because it is `private`.
48 protected:
49 enum : int32_t { d = 4 };
51 enum : int32_t { e = 5 };
53 public:
54 enum : int32_t { f = 6 };
56 enum : int32_t { g = 7 };
58 private:
59 enum class Bar
61 a = 1,
62 b = 2,
65 // Ignored enum `dtoh_21217.Foo.h` because it is `private`.
66 public:
67 Foo() :
68 a(1)
71 Foo(int32_t a) :
72 a(a)
76 ---
80 extern(C++) struct Foo {
81 int a = 1;
82 enum b = 2;
83 private enum c = 3;
84 protected enum d = 4;
85 package enum e = 5;
86 public enum f = 6;
87 export enum g = 7;
89 private enum Bar { a = 1, b = 2 }
90 private enum h = Bar.a;