Well the DMD test-cases worked, but I get Phobos errors when I implicitly generate the module declaration:

```
C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\process.d(2099): Error: variable std.proce
ss.shellSwitch conflicts with variable std.process.shellSwitch at C:\dmd-git\dmd2\windows\b
in\..\..\src\phobos\std\process.d(2098)
C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\math.d(67): Error: module intrinsics is in
 file 'ldc\intrinsics.d' which cannot be read
import path[0] = C:\dmd-git\dmd2\windows\bin\..\..\src\phobos
import path[1] = C:\dmd-git\dmd2\windows\bin\..\..\src\druntime\import
```

Here's the diff:

```diff
diff --git a/src/parse.c b/src/parse.c
index 8790135..5079767 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -70,12 +70,12 @@ Parser::Parser(Module *module, unsigned char *base, size_t length, int doDocComm
 Dsymbols *Parser::parseModule()
 {
     Dsymbols *decldefs;
+    bool safe = FALSE;
 
     // ModuleDeclation leads off
     if (token.value == TOKmodule)
     {
         unsigned char *comment = token.blockComment;
-        bool safe = FALSE;
 
         nextToken();
 #if 0 && DMDV2
@@ -129,6 +129,9 @@ Dsymbols *Parser::parseModule()
         }
     }
 
+    if (md == NULL)  // create an implicit module declaration
+        md = new ModuleDeclaration(NULL, mod->ident, safe);
+
     decldefs = parseDeclDefs(0);
     if (token.value != TOKeof)
     {   error(loc, "unrecognized declaration");
@@ -5652,7 +5655,8 @@ Expression *Parser::parsePrimaryExp()
             break;
 
         case TOKmodulestring:
-        {   const char *s = md->toChars();
+        {
+            const char *s = md->toChars();
             e = new StringExp(loc, (char *)s, strlen(s), 0);
             nextToken();
             break;
diff --git a/test/compilable/extra-files/inlinexheader.di b/test/compilable/extra-files/inlinexheader.di
index a416cc0..7af0739 100644
--- a/test/compilable/extra-files/inlinexheader.di
+++ b/test/compilable/extra-files/inlinexheader.di
@@ -1,3 +1,4 @@
+module inlinexheader;
 class C
 {
 }
diff --git a/test/compilable/extra-files/test7754.di b/test/compilable/extra-files/test7754.di
index 62967b6..34d4b6b 100644
--- a/test/compilable/extra-files/test7754.di
+++ b/test/compilable/extra-files/test7754.di
@@ -1,3 +1,4 @@
+module test7754;
 template Foo(T)
 {
 	struct Foo
diff --git a/test/compilable/extra-files/xheader.di b/test/compilable/extra-files/xheader.di
index f9f5a18..29625ab 100644
--- a/test/compilable/extra-files/xheader.di
+++ b/test/compilable/extra-files/xheader.di
@@ -1,3 +1,4 @@
+module xheader;
 class C
 {
 }
diff --git a/test/compilable/test10339.d b/test/compilable/test10339.d
new file mode 100644
index 0000000..97d72aa
--- /dev/null
+++ b/test/compilable/test10339.d
@@ -0,0 +1,6 @@
+// PERMUTE_ARGS:
+void main()
+{
+    auto name = __MODULE__;
+}
+

```