[llvm-commits] [llvm] r158593 - /llvm/trunk/unittests/ADT/DenseMapTest.cpp

Chandler Carruth chandlerc at gmail.com
Fri Jun 15 20:54:11 PDT 2012


Author: chandlerc
Date: Fri Jun 15 22:54:11 2012
New Revision: 158593

URL: http://llvm.org/viewvc/llvm-project?rev=158593&view=rev
Log:
Work around a bug with MSVC 10 where it fails to recognize a valid use
of typename. GCC and Clang were fine with this, but MSVC won't accept
it. Fortunately, it also doesn't need it. Yuck.

Thanks to Nakamura for pointing this out in IRC.

Modified:
    llvm/trunk/unittests/ADT/DenseMapTest.cpp

Modified: llvm/trunk/unittests/ADT/DenseMapTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/DenseMapTest.cpp?rev=158593&r1=158592&r2=158593&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/DenseMapTest.cpp (original)
+++ llvm/trunk/unittests/ADT/DenseMapTest.cpp Fri Jun 15 22:54:11 2012
@@ -66,8 +66,17 @@
   // Lookup tests
   EXPECT_FALSE(this->Map.count(this->getKey()));
   EXPECT_TRUE(this->Map.find(this->getKey()) == this->Map.end());
+#ifndef _MSC_VER
   EXPECT_EQ(typename TypeParam::mapped_type(),
             this->Map.lookup(this->getKey()));
+#else
+  // MSVC, at least old versions, cannot parse the typename to disambiguate
+  // TypeParam::mapped_type as a type. However, because MSVC doesn't implement
+  // two-phase name lookup, it also doesn't require the typename. Deal with
+  // this mutual incompatibility through specialized code.
+  EXPECT_EQ(TypeParam::mapped_type(),
+            this->Map.lookup(this->getKey()));
+#endif
 }
 
 // Constant map tests





More information about the llvm-commits mailing list