| 1 |
/+ |
| 2 |
REQUIRED_ARGS: -o- -HC |
| 3 |
TEST_OUTPUT: |
| 4 |
--- |
| 5 |
// Automatically generated by Digital Mars D Compiler |
| 6 |
|
| 7 |
#pragma once |
| 8 |
|
| 9 |
#include <assert.h> |
| 10 |
#include <math.h> |
| 11 |
#include <stddef.h> |
| 12 |
#include <stdint.h> |
| 13 |
|
| 14 |
extern int32_t foo(); |
| 15 |
|
| 16 |
extern int32_t* somePtr; |
| 17 |
|
| 18 |
extern void insertedCast(double a = (double) foo()); |
| 19 |
|
| 20 |
extern void explicitCast(int32_t b = foo()); |
| 21 |
|
| 22 |
extern void requiredCast(void* ptr = (void*) foo()); |
| 23 |
|
| 24 |
extern void stcCast(const int32_t* const ci = (const int32_t* const) somePtr); |
| 25 |
|
| 26 |
--- |
| 27 |
+/ |
| 28 |
|
| 29 |
extern (C++): |
| 30 |
|
| 31 |
int foo() { return 0; } |
| 32 |
|
| 33 |
__gshared int* somePtr; |
| 34 |
|
| 35 |
void insertedCast(double a = foo()) {} |
| 36 |
|
| 37 |
void explicitCast(int b = cast(int) foo()) {} |
| 38 |
|
| 39 |
void requiredCast(void* ptr = cast(void*) foo()) {} |
| 40 |
|
| 41 |
void stcCast(const int* ci = cast(immutable) somePtr) {} |
| 42 |
|
| 43 |
/+ |
| 44 |
TEST_OUTPUT: |
| 45 |
--- |
| 46 |
template <typename T> |
| 47 |
extern T insertedTmpl(double a = static_cast<double>(foo())); |
| 48 |
|
| 49 |
template <typename T> |
| 50 |
extern T explicitTmpl(int32_t b = (int32_t) foo()); |
| 51 |
|
| 52 |
template <typename T> |
| 53 |
extern T requiredTmpl(void* ptr = (void*) foo()); |
| 54 |
|
| 55 |
template <typename T> |
| 56 |
extern T stcCastTmpl(int32_t* ci = (int32_t*) somePtr); |
| 57 |
|
| 58 |
template <typename T> |
| 59 |
extern T paramCastTmpl(int32_t* ci = (T) somePtr); |
| 60 |
--- |
| 61 |
+/ |
| 62 |
|
| 63 |
T insertedTmpl(T)(double a = foo()) {} |
| 64 |
|
| 65 |
T explicitTmpl(T)(int b = cast(int) foo()) {} |
| 66 |
|
| 67 |
T requiredTmpl(T)(void* ptr = cast(void*) foo()) {} |
| 68 |
|
| 69 |
T stcCastTmpl(T)(const int* ci = cast(immutable) somePtr) {} |
| 70 |
|
| 71 |
T paramCastTmpl(T)(const int* ci = cast(T) somePtr) {} |
| 72 |
|
| 73 |
/+ |
| 74 |
TEST_OUTPUT: |
| 75 |
--- |
| 76 |
|
| 77 |
struct Data final |
| 78 |
{ |
| 79 |
static Data* pt; |
| 80 |
static int32_t* bar(); |
| 81 |
Data() |
| 82 |
{ |
| 83 |
} |
| 84 |
}; |
| 85 |
|
| 86 |
extern void useData(bool a = !Data::pt, bool b = Data::bar() == nullptr, bool c = Data::bar() != nullptr); |
| 87 |
--- |
| 88 |
+/ |
| 89 |
|
| 90 |
struct Data |
| 91 |
{ |
| 92 |
__gshared Data* pt; |
| 93 |
static int* bar() { return null; } |
| 94 |
} |
| 95 |
|
| 96 |
void useData( |
| 97 |
bool a = !Data.pt, |
| 98 |
bool b = Data.bar() is null, |
| 99 |
bool c = Data.bar() !is null |
| 100 |
) {} |