diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 547f006e7afae02286bbddec077bb521729e67c0..f94aa3ca4a23720ecabaf34dc4ec336410002821 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -1518,7 +1518,7 @@ def satisfies(self, other, deps=True, strict=False):
             return False
 
         # Otherwise, first thing we care about is whether the name matches
-        if self.name != other.name and (not self.name) and (not other.name):
+        if self.name != other.name and self.name and other.name:
             return False
 
         # namespaces either match, or other doesn't require one.