]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR d/90762
authoribuclaw <ibuclaw@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 16 Jun 2019 07:49:30 +0000 (07:49 +0000)
committeribuclaw <ibuclaw@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 16 Jun 2019 07:49:30 +0000 (07:49 +0000)
d/dmd: Merge upstream dmd b0cd59177

Fixes segmentation fault in resolvePropertiesX.

Reviewed-on: https://github.com/dlang/dmd/pull/10006

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@272347 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/d/dmd/MERGE
gcc/d/dmd/statementsem.c
gcc/testsuite/gdc.test/compilable/traits.d [new file with mode: 0644]

index 865462d64fbcf66a9e62f6847479f7a8d73cb52c..36f9aa9c241275b841ba211b7af98b9faab3cde9 100644 (file)
@@ -1,4 +1,4 @@
-d912f4e495412b67f0a2e3b07f645909cfee0212
+b0cd591770fefb4db6eaba89b7a548ef1e980f5c
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/dmd repository.
index ccf141ebb09b37fdd511826e21a4d40232001dc3..0dc5e77b4100a1123586dbb074645ccf4df96ec9 100644 (file)
@@ -3492,12 +3492,18 @@ public:
             }
 
             s->semantic(sc);
-            Module::addDeferredSemantic2(s);     // Bugzilla 14666
-            sc->insert(s);
-
-            for (size_t j = 0; j < s->aliasdecls.dim; j++)
+            // https://issues.dlang.org/show_bug.cgi?id=19942
+            // If the module that's being imported doesn't exist, don't add it to the symbol table
+            // for the current scope.
+            if (s->mod != NULL)
             {
-                sc->insert(s->aliasdecls[j]);
+                Module::addDeferredSemantic2(s);     // Bugzilla 14666
+                sc->insert(s);
+
+                for (size_t j = 0; j < s->aliasdecls.dim; j++)
+                {
+                    sc->insert(s->aliasdecls[j]);
+                }
             }
         }
         result = imps;
diff --git a/gcc/testsuite/gdc.test/compilable/traits.d b/gcc/testsuite/gdc.test/compilable/traits.d
new file mode 100644 (file)
index 0000000..736eae4
--- /dev/null
@@ -0,0 +1,10 @@
+// REQUIRED_ARGS:
+
+// This file is intended to contain all compilable traits-related tests in an
+// effort to keep the number of files in the `compilable` folder to a minimum.
+
+/******************************************/
+// https://issues.dlang.org/show_bug.cgi?id=19942
+
+static assert(!__traits(compiles, { a.init; }));
+static assert(!__traits(compiles, { import m : a; a.init; }));