--- a/lisp/files.el	2015-01-17 19:02:00 +0000
+++ b/lisp/files.el
@@ -3604,7 +3604,8 @@ defun dir-locals-collect-variables (class-variables root variables)
 Return the new variables list."
   (let* ((file-name (or (buffer-file-name)
 			;; Handle non-file buffers, too.
-			(expand-file-name default-directory)))
+			(file-name-as-directory
+			 (expand-file-name default-directory))))
 	 (sub-file-name (if file-name
                             ;; FIXME: Why not use file-relative-name?
 			    (substring file-name (length root)))))
