| 1 |
/* |
| 2 |
REQUIRED_ARGS: -HC -c -o- |
| 3 |
PERMUTE_ARGS: |
| 4 |
TEST_OUTPUT: |
| 5 |
--- |
| 6 |
// Automatically generated by Digital Mars D Compiler |
| 7 |
|
| 8 |
#pragma once |
| 9 |
|
| 10 |
#include <assert.h> |
| 11 |
#include <math.h> |
| 12 |
#include <stddef.h> |
| 13 |
#include <stdint.h> |
| 14 |
|
| 15 |
struct S final |
| 16 |
{ |
| 17 |
union |
| 18 |
{ |
| 19 |
int32_t x; |
| 20 |
char c[4$?:32=u|64=LLU$]; |
| 21 |
}; |
| 22 |
struct |
| 23 |
{ |
| 24 |
int32_t y; |
| 25 |
double z; |
| 26 |
void bar(); |
| 27 |
}; |
| 28 |
struct |
| 29 |
{ |
| 30 |
int32_t outerPrivate; |
| 31 |
}; |
| 32 |
struct |
| 33 |
{ |
| 34 |
int32_t innerPrivate; |
| 35 |
int32_t innerBar; |
| 36 |
}; |
| 37 |
S() : |
| 38 |
y(), |
| 39 |
z(), |
| 40 |
outerPrivate(), |
| 41 |
innerPrivate(), |
| 42 |
innerBar() |
| 43 |
{ |
| 44 |
} |
| 45 |
S(int32_t y, double z = NAN, int32_t outerPrivate = 0, int32_t innerPrivate = 0, int32_t innerBar = 0) : |
| 46 |
y(y), |
| 47 |
z(z), |
| 48 |
outerPrivate(outerPrivate), |
| 49 |
innerPrivate(innerPrivate), |
| 50 |
innerBar(innerBar) |
| 51 |
{} |
| 52 |
}; |
| 53 |
|
| 54 |
extern void foo(); |
| 55 |
--- |
| 56 |
*/ |
| 57 |
|
| 58 |
extern (C++) struct S |
| 59 |
{ |
| 60 |
union |
| 61 |
{ |
| 62 |
int x; |
| 63 |
char[4] c; |
| 64 |
} |
| 65 |
|
| 66 |
struct |
| 67 |
{ |
| 68 |
int y; |
| 69 |
double z; |
| 70 |
extern(C) void foo() {} |
| 71 |
extern(C++) void bar() {} |
| 72 |
} |
| 73 |
|
| 74 |
// Private not emitted because AnonDeclaration has no protection |
| 75 |
private struct |
| 76 |
{ |
| 77 |
int outerPrivate; |
| 78 |
} |
| 79 |
|
| 80 |
public struct { |
| 81 |
// Private cannot be exported to C++ |
| 82 |
private int innerPrivate; |
| 83 |
int innerBar; |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
extern (D) |
| 88 |
{ |
| 89 |
extern(C++) void foo() {} |
| 90 |
} |