[libcxx] r294156 - [libcxx] [test] Fix Clang -Wunused-local-typedef, part 3/3.

Stephan T. Lavavej via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 5 14:47:54 PST 2017


Author: stl_msft
Date: Sun Feb  5 16:47:54 2017
New Revision: 294156

URL: http://llvm.org/viewvc/llvm-project?rev=294156&view=rev
Log:
[libcxx] [test] Fix Clang -Wunused-local-typedef, part 3/3.

test/std/strings/string.classes/typedefs.pass.cpp
Actually test what basic_string's typedefs stand for.

test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp
NotDerived and ND were completely unused.

test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
P2 was mistakenly not being used. Yes, that's
right: -Wunused-local-typedef CAUGHT A MISTAKE! AMAZING!

Fixes D29137.

Modified:
    libcxx/trunk/test/std/strings/string.classes/typedefs.pass.cpp
    libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp
    libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp

Modified: libcxx/trunk/test/std/strings/string.classes/typedefs.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.classes/typedefs.pass.cpp?rev=294156&r1=294155&r2=294156&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/string.classes/typedefs.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/string.classes/typedefs.pass.cpp Sun Feb  5 16:47:54 2017
@@ -18,13 +18,14 @@
 // typedef basic_string<wchar_t> wstring;
 
 #include <string>
+#include <type_traits>
 
 int main()
 {
-    typedef std::string test1;
-    typedef std::wstring test2;
+    static_assert((std::is_same<std::string, std::basic_string<char> >::value), "");
+    static_assert((std::is_same<std::wstring, std::basic_string<wchar_t> >::value), "");
 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-    typedef std::u16string test3;
-    typedef std::u32string test4;
+    static_assert((std::is_same<std::u16string, std::basic_string<char16_t> >::value), "");
+    static_assert((std::is_same<std::u32string, std::basic_string<char32_t> >::value), "");
 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
 }

Modified: libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp?rev=294156&r1=294155&r2=294156&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp Sun Feb  5 16:47:54 2017
@@ -26,7 +26,6 @@ struct wat
 
 struct F {};
 struct FD : public F {};
-struct NotDerived {};
 
 template <class T, class U>
 void test_result_of_imp()
@@ -43,7 +42,6 @@ void test_result_of_imp()
 
 int main()
 {
-    typedef NotDerived ND;
     {
     typedef char F::*PMD;
     test_result_of_imp<PMD(F                &), char                &>();

Modified: libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp?rev=294156&r1=294155&r2=294156&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp Sun Feb  5 16:47:54 2017
@@ -49,7 +49,7 @@ int main()
         using P = std::pair<int, NoDefault>;
         static_assert(!std::is_default_constructible<P>::value, "");
         using P2 = std::pair<NoDefault, int>;
-        static_assert(!std::is_default_constructible<P>::value, "");
+        static_assert(!std::is_default_constructible<P2>::value, "");
     }
 #endif
 }




More information about the cfe-commits mailing list