diff options
Diffstat (limited to 'gcc/testsuite/gdc.test/compilable/dtoh_CPPNamespaceDeclaration.d')
-rw-r--r-- | gcc/testsuite/gdc.test/compilable/dtoh_CPPNamespaceDeclaration.d | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.test/compilable/dtoh_CPPNamespaceDeclaration.d b/gcc/testsuite/gdc.test/compilable/dtoh_CPPNamespaceDeclaration.d new file mode 100644 index 00000000000..6995a675256 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/dtoh_CPPNamespaceDeclaration.d @@ -0,0 +1,67 @@ +/* +REQUIRED_ARGS: -HC -c -o- +PERMUTE_ARGS: +TEST_OUTPUT: +--- +// Automatically generated by Digital Mars D Compiler + +#pragma once + +#include <assert.h> +#include <stddef.h> +#include <stdint.h> +#include <math.h> + +#ifdef CUSTOM_D_ARRAY_TYPE +#define _d_dynamicArray CUSTOM_D_ARRAY_TYPE +#else +/// Represents a D [] array +template<typename T> +struct _d_dynamicArray final +{ + size_t length; + T *ptr; + + _d_dynamicArray() : length(0), ptr(NULL) { } + + _d_dynamicArray(size_t length_in, T *ptr_in) + : length(length_in), ptr(ptr_in) { } + + T& operator[](const size_t idx) { + assert(idx < length); + return ptr[idx]; + } + + const T& operator[](const size_t idx) const { + assert(idx < length); + return ptr[idx]; + } +}; +#endif + +namespace nameSpace +{ + extern void fn(); + + namespace nameSpace2 + { + extern void fn2(); + + } + extern double identity(double _param_0); + +} +--- +*/ + +extern(C++, "nameSpace") +{ + void fn() {} + + extern(C++, nameSpace2) + { + void fn2() {} + } + + double identity(double) { return _param_0; } +} |