diff --git a/dstep/translator/Type.d b/dstep/translator/Type.d index 3bd80b49..d48686d0 100644 --- a/dstep/translator/Type.d +++ b/dstep/translator/Type.d @@ -300,8 +300,11 @@ do if (declaration.isValid) return translateType(context, declaration, rewriteIdToObjcObject); else + { + type = type.canonical.isValid ? type.canonical : type; return translateType(context, type.kind, rewriteIdToObjcObject) .makeSourceNode(); + } } string translateComplex (Type type) diff --git a/tests/functional/Tests.d b/tests/functional/Tests.d index 7eebf707..942f979e 100644 --- a/tests/functional/Tests.d +++ b/tests/functional/Tests.d @@ -227,6 +227,14 @@ unittest ); } +unittest +{ + assertRunsDStepCFile( + "tests/functional/size_t_redeclared.d", + "tests/functional/size_t_redeclared.h" + ); +} + // DStep should exit with non-zero status when an input file doesn't exist. unittest { diff --git a/tests/functional/size_t_redeclared.d b/tests/functional/size_t_redeclared.d new file mode 100644 index 00000000..e035cd13 --- /dev/null +++ b/tests/functional/size_t_redeclared.d @@ -0,0 +1,6 @@ +import core.stdc.config; + +extern (C): + +c_ulong strlen (const(char)* __s); +c_ulong fread (); diff --git a/tests/functional/size_t_redeclared.h b/tests/functional/size_t_redeclared.h new file mode 100644 index 00000000..9d1c784a --- /dev/null +++ b/tests/functional/size_t_redeclared.h @@ -0,0 +1,6 @@ + +#include + +size_t strlen(const char *__s); +size_t fread(); +