[libcxx] r224658 - Move test into test/std subdirectory.

Eric Fiselier eric at efcs.ca
Fri Dec 19 17:40:31 PST 2014


Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_long.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_long.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_long.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_long.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,344 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_put<charT, OutputIterator>
+
+// iter_type put(iter_type s, ios_base& iob, char_type fill, long long v) const;
+
+#include <locale>
+#include <ios>
+#include <cassert>
+#include <streambuf>
+#include "test_iterators.h"
+
+typedef std::num_put<char, output_iterator<char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+class my_numpunct
+    : public std::numpunct<char>
+{
+public:
+    my_numpunct() : std::numpunct<char>() {}
+
+protected:
+    virtual char_type do_thousands_sep() const {return '_';}
+    virtual std::string do_grouping() const {return std::string("\1\2\3");}
+};
+
+int main()
+{
+    const my_facet f(1);
+    {
+        std::ios ios(0);
+        long long v = 0;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0");
+    }
+    {
+        std::ios ios(0);
+        long long v = 1;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1");
+    }
+    {
+        std::ios ios(0);
+        long long v = -1;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1");
+    }
+    {
+        std::ios ios(0);
+        long long v = -1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1000");
+    }
+    {
+        std::ios ios(0);
+        long long v = 1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1000");
+    }
+    {
+        std::ios ios(0);
+        showpos(ios);
+        long long v = 1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "+1000");
+    }
+    {
+        std::ios ios(0);
+        oct(ios);
+        long long v = 1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1750");
+    }
+    {
+        std::ios ios(0);
+        oct(ios);
+        showbase(ios);
+        long long v = 1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "01750");
+    }
+    {
+        std::ios ios(0);
+        hex(ios);
+        long long v = 1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "3e8");
+    }
+    {
+        std::ios ios(0);
+        hex(ios);
+        showbase(ios);
+        long long v = 1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0x3e8");
+    }
+    {
+        std::ios ios(0);
+        hex(ios);
+        showbase(ios);
+        uppercase(ios);
+        long long v = 1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0X3E8");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        hex(ios);
+        showbase(ios);
+        uppercase(ios);
+        long long v = 1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0X3E_8");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        hex(ios);
+        showbase(ios);
+        long long v = 2147483647;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0x7f_fff_ff_f");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        oct(ios);
+        long long v = 0123467;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "123_46_7");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        oct(ios);
+        showbase(ios);
+        long long v = 0123467;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0_123_46_7");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        oct(ios);
+        showbase(ios);
+        right(ios);
+        ios.width(15);
+        long long v = 0123467;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "*****0_123_46_7");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        oct(ios);
+        showbase(ios);
+        left(ios);
+        ios.width(15);
+        long long v = 0123467;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0_123_46_7*****");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        oct(ios);
+        showbase(ios);
+        internal(ios);
+        ios.width(15);
+        long long v = 0123467;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "*****0_123_46_7");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        hex(ios);
+        showbase(ios);
+        right(ios);
+        ios.width(15);
+        long long v = 2147483647;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "**0x7f_fff_ff_f");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        hex(ios);
+        showbase(ios);
+        left(ios);
+        ios.width(15);
+        long long v = 2147483647;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0x7f_fff_ff_f**");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        hex(ios);
+        showbase(ios);
+        internal(ios);
+        ios.width(15);
+        long long v = 2147483647;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0x**7f_fff_ff_f");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        showpos(ios);
+        long long v = 1000;
+        right(ios);
+        ios.width(10);
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "***+1_00_0");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        showpos(ios);
+        long long v = 1000;
+        left(ios);
+        ios.width(10);
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "+1_00_0***");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        showpos(ios);
+        long long v = 1000;
+        internal(ios);
+        ios.width(10);
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "+***1_00_0");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        long long v = -1000;
+        right(ios);
+        showpos(ios);
+        ios.width(10);
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "***-1_00_0");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        long long v = -1000;
+        left(ios);
+        ios.width(10);
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-1_00_0***");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        long long v = -1000;
+        internal(ios);
+        ios.width(10);
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "-***1_00_0");
+        assert(ios.width() == 0);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_put<charT, OutputIterator>
+
+// iter_type put(iter_type s, ios_base& iob, char_type fill, void* v) const;
+
+#include <locale>
+#include <ios>
+#include <cassert>
+#include <streambuf>
+#include "test_iterators.h"
+
+typedef std::num_put<char, output_iterator<char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    {
+        std::ios ios(0);
+        void* v = 0;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0x0" || ex == "(nil)");
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,374 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_put<charT, OutputIterator>
+
+// iter_type put(iter_type s, ios_base& iob, char_type fill, unsigned long v) const;
+
+#include <locale>
+#include <ios>
+#include <cassert>
+#include <streambuf>
+#include "test_iterators.h"
+
+typedef std::num_put<char, output_iterator<char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+class my_numpunct
+    : public std::numpunct<char>
+{
+public:
+    my_numpunct() : std::numpunct<char>() {}
+
+protected:
+    virtual char_type do_thousands_sep() const {return '_';}
+    virtual std::string do_grouping() const {return std::string("\1\2\3");}
+};
+
+int main()
+{
+    const my_facet f(1);
+    {
+        std::ios ios(0);
+        unsigned long v = 0;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0");
+    }
+    {
+        std::ios ios(0);
+        unsigned long v = 1;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1");
+    }
+    {
+        std::ios ios(0);
+        unsigned long v = -1;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == (sizeof(unsigned long) == 4 ? "4294967295" : "18446744073709551615"));
+    }
+    {
+        std::ios ios(0);
+        unsigned long v = -1000;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == (sizeof(unsigned long) == 4 ? "4294966296" : "18446744073709550616"));
+    }
+    {
+        std::ios ios(0);
+        unsigned long v = 1000;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1000");
+    }
+    {
+        std::ios ios(0);
+        showpos(ios);
+        unsigned long v = 1000;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1000");
+    }
+    {
+        std::ios ios(0);
+        oct(ios);
+        unsigned long v = 1000;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1750");
+    }
+    {
+        std::ios ios(0);
+        oct(ios);
+        showbase(ios);
+        unsigned long v = 1000;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "01750");
+    }
+    {
+        std::ios ios(0);
+        hex(ios);
+        unsigned long v = 1000;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "3e8");
+    }
+    {
+        std::ios ios(0);
+        hex(ios);
+        showbase(ios);
+        unsigned long v = 1000;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0x3e8");
+    }
+    {
+        std::ios ios(0);
+        hex(ios);
+        showbase(ios);
+        uppercase(ios);
+        unsigned long v = 1000;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0X3E8");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        hex(ios);
+        showbase(ios);
+        uppercase(ios);
+        unsigned long v = 1000;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0X3E_8");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        hex(ios);
+        showbase(ios);
+        unsigned long v = 2147483647;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0x7f_fff_ff_f");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        oct(ios);
+        unsigned long v = 0123467;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "123_46_7");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        oct(ios);
+        showbase(ios);
+        unsigned long v = 0123467;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0_123_46_7");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        oct(ios);
+        showbase(ios);
+        right(ios);
+        ios.width(15);
+        unsigned long v = 0123467;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "*****0_123_46_7");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        oct(ios);
+        showbase(ios);
+        left(ios);
+        ios.width(15);
+        unsigned long v = 0123467;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0_123_46_7*****");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        oct(ios);
+        showbase(ios);
+        internal(ios);
+        ios.width(15);
+        unsigned long v = 0123467;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "*****0_123_46_7");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        hex(ios);
+        showbase(ios);
+        right(ios);
+        ios.width(15);
+        unsigned long v = 2147483647;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "**0x7f_fff_ff_f");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        hex(ios);
+        showbase(ios);
+        left(ios);
+        ios.width(15);
+        unsigned long v = 2147483647;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0x7f_fff_ff_f**");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        hex(ios);
+        showbase(ios);
+        internal(ios);
+        ios.width(15);
+        unsigned long v = 2147483647;
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0x**7f_fff_ff_f");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        showpos(ios);
+        unsigned long v = 1000;
+        right(ios);
+        ios.width(10);
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "****1_00_0");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        showpos(ios);
+        unsigned long v = 1000;
+        left(ios);
+        ios.width(10);
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1_00_0****");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        showpos(ios);
+        unsigned long v = 1000;
+        internal(ios);
+        ios.width(10);
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "****1_00_0");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        unsigned long v = -1000;
+        right(ios);
+        showpos(ios);
+        ios.width(10);
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == (sizeof(unsigned long) == 4 ? "4_294_966_29_6"
+                                                 : "18_446_744_073_709_550_61_6"));
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        unsigned long v = -1000;
+        left(ios);
+        ios.width(10);
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == (sizeof(unsigned long) == 4 ? "4_294_966_29_6"
+                                                 : "18_446_744_073_709_550_61_6"));
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        unsigned long v = -1000;
+        internal(ios);
+        ios.width(10);
+        char str[50];
+        std::ios_base::iostate err = ios.goodbit;
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == (sizeof(unsigned long) == 4 ? "4_294_966_29_6"
+                                                 : "18_446_744_073_709_550_61_6"));
+        assert(ios.width() == 0);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,344 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_put<charT, OutputIterator>
+
+// iter_type put(iter_type s, ios_base& iob, char_type fill, unsigned long long v) const;
+
+#include <locale>
+#include <ios>
+#include <cassert>
+#include <streambuf>
+#include "test_iterators.h"
+
+typedef std::num_put<char, output_iterator<char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+class my_numpunct
+    : public std::numpunct<char>
+{
+public:
+    my_numpunct() : std::numpunct<char>() {}
+
+protected:
+    virtual char_type do_thousands_sep() const {return '_';}
+    virtual std::string do_grouping() const {return std::string("\1\2\3");}
+};
+
+int main()
+{
+    const my_facet f(1);
+    {
+        std::ios ios(0);
+        unsigned long long v = 0;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0");
+    }
+    {
+        std::ios ios(0);
+        unsigned long long v = 1;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1");
+    }
+    {
+        std::ios ios(0);
+        unsigned long long v = -1;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == (sizeof(unsigned long long) == 4 ? "4294967295" : "18446744073709551615"));
+    }
+    {
+        std::ios ios(0);
+        unsigned long long v = -1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "18446744073709550616");
+    }
+    {
+        std::ios ios(0);
+        unsigned long long v = 1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1000");
+    }
+    {
+        std::ios ios(0);
+        showpos(ios);
+        unsigned long long v = 1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1000");
+    }
+    {
+        std::ios ios(0);
+        oct(ios);
+        unsigned long long v = 1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1750");
+    }
+    {
+        std::ios ios(0);
+        oct(ios);
+        showbase(ios);
+        unsigned long long v = 1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "01750");
+    }
+    {
+        std::ios ios(0);
+        hex(ios);
+        unsigned long long v = 1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "3e8");
+    }
+    {
+        std::ios ios(0);
+        hex(ios);
+        showbase(ios);
+        unsigned long long v = 1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0x3e8");
+    }
+    {
+        std::ios ios(0);
+        hex(ios);
+        showbase(ios);
+        uppercase(ios);
+        unsigned long long v = 1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0X3E8");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        hex(ios);
+        showbase(ios);
+        uppercase(ios);
+        unsigned long long v = 1000;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0X3E_8");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        hex(ios);
+        showbase(ios);
+        unsigned long long v = 2147483647;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0x7f_fff_ff_f");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        oct(ios);
+        unsigned long long v = 0123467;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "123_46_7");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        oct(ios);
+        showbase(ios);
+        unsigned long long v = 0123467;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0_123_46_7");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        oct(ios);
+        showbase(ios);
+        right(ios);
+        ios.width(15);
+        unsigned long long v = 0123467;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "*****0_123_46_7");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        oct(ios);
+        showbase(ios);
+        left(ios);
+        ios.width(15);
+        unsigned long long v = 0123467;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0_123_46_7*****");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        oct(ios);
+        showbase(ios);
+        internal(ios);
+        ios.width(15);
+        unsigned long long v = 0123467;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "*****0_123_46_7");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        hex(ios);
+        showbase(ios);
+        right(ios);
+        ios.width(15);
+        unsigned long long v = 2147483647;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "**0x7f_fff_ff_f");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        hex(ios);
+        showbase(ios);
+        left(ios);
+        ios.width(15);
+        unsigned long long v = 2147483647;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0x7f_fff_ff_f**");
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        hex(ios);
+        showbase(ios);
+        internal(ios);
+        ios.width(15);
+        unsigned long long v = 2147483647;
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "0x**7f_fff_ff_f");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        showpos(ios);
+        unsigned long long v = 1000;
+        right(ios);
+        ios.width(10);
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "****1_00_0");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        showpos(ios);
+        unsigned long long v = 1000;
+        left(ios);
+        ios.width(10);
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "1_00_0****");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        showpos(ios);
+        unsigned long long v = 1000;
+        internal(ios);
+        ios.width(10);
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "****1_00_0");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        unsigned long long v = -1000;
+        right(ios);
+        showpos(ios);
+        ios.width(10);
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "18_446_744_073_709_550_61_6");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        unsigned long long v = -1000;
+        left(ios);
+        ios.width(10);
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "18_446_744_073_709_550_61_6");
+        assert(ios.width() == 0);
+    }
+    {
+        std::ios ios(0);
+        ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
+        unsigned long long v = -1000;
+        internal(ios);
+        ios.width(10);
+        char str[50];
+        output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
+        std::string ex(str, iter.base());
+        assert(ex == "18_446_744_073_709_550_61_6");
+        assert(ios.width() == 0);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.virtuals/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.virtuals/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.virtuals/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.virtuals/tested_elsewhere.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/types.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.nm.put/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT, class OutputIterator = ostreambuf_iterator<charT> >
+// class num_put
+//     : public locale::facet
+// {
+// public:
+//     typedef charT          char_type;
+//     typedef OutputIterator iter_type;
+
+#include <locale>
+#include <iterator>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::locale::facet, std::num_put<char> >::value), "");
+    static_assert((std::is_base_of<std::locale::facet, std::num_put<wchar_t> >::value), "");
+    static_assert((std::is_same<std::num_put<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::num_put<wchar_t>::char_type, wchar_t>::value), "");
+    static_assert((std::is_same<std::num_put<char>::iter_type, std::ostreambuf_iterator<char> >::value), "");
+    static_assert((std::is_same<std::num_put<wchar_t>::iter_type, std::ostreambuf_iterator<wchar_t> >::value), "");
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/ctor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/ctor.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/ctor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_get<charT, InputIterator>
+
+// explicit num_get(size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+typedef std::num_get<char, char*> F;
+
+class my_facet
+    : public F
+{
+public:
+    static int count;
+
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet);
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_bool.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_bool.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_bool.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_bool.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,230 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_get<charT, InputIterator>
+
+// iter_type get(iter_type in, iter_type end, ios_base&,
+//               ios_base::iostate& err, bool& v) const;
+
+#include <locale>
+#include <ios>
+#include <cassert>
+#include <streambuf>
+#include "test_iterators.h"
+
+typedef std::num_get<char, input_iterator<const char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+class p1
+    : public std::numpunct<char>
+{
+public:
+    p1() : std::numpunct<char>() {}
+
+protected:
+    virtual string_type do_truename() const {return "a";}
+    virtual string_type do_falsename() const {return "abb";}
+};
+
+class p2
+    : public std::numpunct<char>
+{
+public:
+    p2() : std::numpunct<char>() {}
+
+protected:
+    virtual string_type do_truename() const {return "a";}
+    virtual string_type do_falsename() const {return "ab";}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    {
+        const char str[] = "1";
+        std::ios_base::iostate err = ios.goodbit;
+        bool b;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, b);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(b == true);
+    }
+    {
+        const char str[] = "0";
+        std::ios_base::iostate err = ios.goodbit;
+        bool b;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, b);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(b == false);
+    }
+    {
+        const char str[] = "12";
+        std::ios_base::iostate err = ios.goodbit;
+        bool b;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, b);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(b == true);
+    }
+    {
+        const char str[] = "*12";
+        std::ios_base::iostate err = ios.goodbit;
+        bool b;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, b);
+        assert(iter.base() == str+0);
+        assert(err == ios.failbit);
+        assert(b == false);
+    }
+    boolalpha(ios);
+    {
+        const char str[] = "1";
+        std::ios_base::iostate err = ios.goodbit;
+        bool b;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, b);
+        assert(iter.base() == str+0);
+        assert(err == ios.failbit);
+        assert(b == false);
+    }
+    {
+        const char str[] = "true";
+        std::ios_base::iostate err = ios.goodbit;
+        bool b;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, b);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(b == true);
+    }
+    {
+        const char str[] = "false";
+        std::ios_base::iostate err = ios.goodbit;
+        bool b;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, b);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(b == false);
+    }
+    ios.imbue(std::locale(ios.getloc(), new p1));
+    {
+        const char str[] = "a";
+        std::ios_base::iostate err = ios.goodbit;
+        bool b;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+1),
+                  ios, err, b);
+        assert(iter.base() == str+1);
+        assert(err == ios.eofbit);
+        assert(b == true);
+    }
+    {
+        const char str[] = "abc";
+        std::ios_base::iostate err = ios.goodbit;
+        bool b;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+3),
+                  ios, err, b);
+        assert(iter.base() == str+2);
+        assert(err == ios.failbit);
+        assert(b == false);
+    }
+    {
+        const char str[] = "acc";
+        std::ios_base::iostate err = ios.goodbit;
+        bool b;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+3),
+                  ios, err, b);
+        assert(iter.base() == str+1);
+        assert(err == ios.goodbit);
+        assert(b == true);
+    }
+    ios.imbue(std::locale(ios.getloc(), new p2));
+    {
+        const char str[] = "a";
+        std::ios_base::iostate err = ios.goodbit;
+        bool b;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+1),
+                  ios, err, b);
+        assert(iter.base() == str+1);
+        assert(err == ios.eofbit);
+        assert(b == true);
+    }
+    {
+        const char str[] = "ab";
+        std::ios_base::iostate err = ios.goodbit;
+        bool b;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+2),
+                  ios, err, b);
+        assert(iter.base() == str+2);
+        assert(err == ios.eofbit);
+        assert(b == false);
+    }
+    {
+        const char str[] = "abc";
+        std::ios_base::iostate err = ios.goodbit;
+        bool b;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+3),
+                  ios, err, b);
+        assert(iter.base() == str+2);
+        assert(err == ios.goodbit);
+        assert(b == false);
+    }
+    {
+        const char str[] = "ac";
+        std::ios_base::iostate err = ios.goodbit;
+        bool b;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+2),
+                  ios, err, b);
+        assert(iter.base() == str+1);
+        assert(err == ios.goodbit);
+        assert(b == true);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,256 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// XFAIL: with_system_lib=x86_64-apple-darwin11
+// XFAIL: with_system_lib=x86_64-apple-darwin12
+
+// <locale>
+
+// class num_get<charT, InputIterator>
+
+// iter_type get(iter_type in, iter_type end, ios_base&,
+//               ios_base::iostate& err, double& v) const;
+
+#include <locale>
+#include <ios>
+#include <cassert>
+#include <streambuf>
+#include <cmath>
+#include "test_iterators.h"
+#include "hexfloat.h"
+
+typedef std::num_get<char, input_iterator<const char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+class my_numpunct
+    : public std::numpunct<char>
+{
+public:
+    my_numpunct() : std::numpunct<char>() {}
+
+protected:
+    virtual char_type do_decimal_point() const {return ';';}
+    virtual char_type do_thousands_sep() const {return '_';}
+    virtual std::string do_grouping() const {return std::string("\1\2\3");}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    double v = -1;
+    {
+        const char str[] = "123";
+        assert((ios.flags() & ios.basefield) == ios.dec);
+        assert(ios.getloc().name() == "C");
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 123);
+    }
+    {
+        const char str[] = "-123";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == -123);
+    }
+    {
+        const char str[] = "123.5";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 123.5);
+    }
+    {
+        const char str[] = "125e-1";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 125e-1);
+    }
+    {
+        const char str[] = "0x125p-1";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == hexfloat<double>(0x125, 0, -1));
+    }
+    {
+        const char str[] = "inf";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == INFINITY);
+    }
+    {
+        const char str[] = "INF";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == INFINITY);
+    }
+    {
+        const char str[] = "-inf";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == -INFINITY);
+    }
+    {
+        const char str[] = "-INF";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == -INFINITY);
+    }
+    {
+        const char str[] = "nan";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(std::isnan(v));
+    }
+    {
+        const char str[] = "NAN";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(std::isnan(v));
+    }
+    {
+        v = -1;
+        const char str[] = "123_456_78_9;125";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+3);
+        assert(err == ios.goodbit);
+        assert(v == 123);
+    }
+    {
+        v = -1;
+        const char str[] = "2-";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+1);
+        assert(err == ios.goodbit);
+        assert(v == 2);
+    }
+    ios.imbue(std::locale(std::locale(), new my_numpunct));
+    {
+        v = -1;
+        const char str[] = "123_456_78_9;125";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 123456789.125);
+    }
+    {
+        v = -1;
+        const char str[] = "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+    }
+    {
+        v = -1;
+        const char str[] = "3;14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651e+10";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(std::abs(v - 3.14159265358979e+10)/3.14159265358979e+10 < 1.e-8);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,171 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_get<charT, InputIterator>
+
+// iter_type get(iter_type in, iter_type end, ios_base&,
+//               ios_base::iostate& err, float& v) const;
+
+#include <locale>
+#include <ios>
+#include <cassert>
+#include <streambuf>
+#include <cmath>
+#include "test_iterators.h"
+#include "hexfloat.h"
+
+typedef std::num_get<char, input_iterator<const char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    float v = -1;
+    {
+        const char str[] = "123";
+        assert((ios.flags() & ios.basefield) == ios.dec);
+        assert(ios.getloc().name() == "C");
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 123);
+    }
+    {
+        const char str[] = "-123";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == -123);
+    }
+    {
+        const char str[] = "123.5";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 123.5);
+    }
+    {
+        const char str[] = "125e-1";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 125e-1);
+    }
+    {
+        const char str[] = "0x125p-1";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == hexfloat<float>(0x125, 0, -1));
+    }
+    {
+        const char str[] = "inf";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == INFINITY);
+    }
+    {
+        const char str[] = "INF";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == INFINITY);
+    }
+    {
+        const char str[] = "-inf";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == -INFINITY);
+    }
+    {
+        const char str[] = "-INF";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == -INFINITY);
+    }
+    {
+        const char str[] = "nan";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(std::isnan(v));
+    }
+    {
+        const char str[] = "NAN";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(std::isnan(v));
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,519 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_get<charT, InputIterator>
+
+// iter_type get(iter_type in, iter_type end, ios_base&,
+//               ios_base::iostate& err, long& v) const;
+
+#include <locale>
+#include <ios>
+#include <cassert>
+#include <streambuf>
+#include "test_iterators.h"
+
+typedef std::num_get<char, input_iterator<const char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+class my_numpunct
+    : public std::numpunct<char>
+{
+public:
+    my_numpunct() : std::numpunct<char>() {}
+
+protected:
+    virtual char_type do_thousands_sep() const {return '_';}
+    virtual std::string do_grouping() const {return std::string("\1\2\3");}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    long v = -1;
+    {
+        const char str[] = "123";
+        assert((ios.flags() & ios.basefield) == ios.dec);
+        assert(ios.getloc().name() == "C");
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+3);
+        assert(err == ios.goodbit);
+        assert(v == 123);
+    }
+    {
+        const char str[] = "-123";
+        assert((ios.flags() & ios.basefield) == ios.dec);
+        assert(ios.getloc().name() == "C");
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+4);
+        assert(err == ios.goodbit);
+        assert(v == -123);
+    }
+    {
+        const char str[] = "123";
+        oct(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+3);
+        assert(err == ios.goodbit);
+        assert(v == 83);
+    }
+    {
+        const char str[] = "123";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+3);
+        assert(err == ios.goodbit);
+        assert(v == 291);
+    }
+    {
+        const char str[] = "0x123";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 291);
+    }
+    {
+        const char str[] = "123";
+        ios.setf(0, ios.basefield);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 123);
+    }
+    {
+        const char str[] = "0x123";
+        ios.setf(0, ios.basefield);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 291);
+    }
+    {
+        const char str[] = "0123";
+        ios.setf(0, ios.basefield);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 83);
+    }
+    {
+        const char str[] = "2-";
+        ios.setf(0, ios.basefield);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+1);
+        assert(err == ios.goodbit);
+        assert(v == 2);
+    }
+    dec(ios);
+    ios.imbue(std::locale(std::locale(), new my_numpunct));
+    {
+        v = -1;
+        const char str[] = "123";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 123);
+    }
+    {
+        v = -1;
+        const char str[] = "+1";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 1);
+    }
+    {
+        v = -1;
+        const char str[] = "+1_";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 1);
+    }
+    {
+        v = -1;
+        const char str[] = "+_1";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 1);
+    }
+    {
+        v = -1;
+        const char str[] = "_+1";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 1);
+    }
+    {
+        v = -1;
+        const char str[] = "+1__";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 1);
+    }
+    {
+        v = -1;
+        const char str[] = "+_1_";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 1);
+    }
+    {
+        v = -1;
+        const char str[] = "_+1_";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 1);
+    }
+    {
+        v = -1;
+        const char str[] = "+__1";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 1);
+    }
+    {
+        v = -1;
+        const char str[] = "_+_1";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 1);
+    }
+    {
+        v = -1;
+        const char str[] = "__+1";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 1);
+    }
+    {
+        v = -1;
+        const char str[] = "+1_2";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 12);
+    }
+    {
+        v = -1;
+        const char str[] = "+12_";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 12);
+    }
+    {
+        v = -1;
+        const char str[] = "+_12";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 12);
+    }
+    {
+        v = -1;
+        const char str[] = "+1__2";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 12);
+    }
+    {
+        v = -1;
+        const char str[] = "+12_3";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 123);
+    }
+    {
+        v = -1;
+        const char str[] = "+1_23";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 123);
+    }
+    {
+        v = -1;
+        const char str[] = "+1_23_4";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 1234);
+    }
+    {
+        v = -1;
+        const char str[] = "+123_4";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 1234);
+    }
+    {
+        v = -1;
+        const char str[] = "+12_34";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 1234);
+    }
+    {
+        v = -1;
+        const char str[] = "+12_34_5";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 12345);
+    }
+    {
+        v = -1;
+        const char str[] = "+123_45_6";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 123456);
+    }
+    {
+        v = -1;
+        const char str[] = "+1_23_45_6";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 123456);
+    }
+    {
+        v = -1;
+        const char str[] = "+1_234_56_7";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 1234567);
+    }
+    {
+        v = -1;
+        const char str[] = "+1_234_567_89_0";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 1234567890);
+    }
+    {
+        v = -1;
+        const char str[] = "-1_234_567_89_0";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == -1234567890);
+    }
+    {
+        v = -1;
+        const char str[] = "1_234_567_89_0";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 1234567890);
+    }
+    {
+        v = -1;
+        const char str[] = "1234_567_89_0";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == 1234567890);
+    }
+    {
+        v = -1;
+        const char str[] = "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_"
+                           "1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_1_2_3_4_5_6_7_8_9_0_";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == std::numeric_limits<long>::max());
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,231 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_get<charT, InputIterator>
+
+// iter_type get(iter_type in, iter_type end, ios_base&,
+//               ios_base::iostate& err, long double& v) const;
+
+#include <locale>
+#include <ios>
+#include <cassert>
+#include <streambuf>
+#include <cmath>
+#include "test_iterators.h"
+#include "hexfloat.h"
+
+typedef std::num_get<char, input_iterator<const char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    long double v = -1;
+    {
+        const char str[] = "123";
+        assert((ios.flags() & ios.basefield) == ios.dec);
+        assert(ios.getloc().name() == "C");
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 123);
+    }
+    {
+        const char str[] = "-123";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == -123);
+    }
+    {
+        const char str[] = "123.5";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 123.5);
+    }
+    {
+        const char str[] = "125e-1";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 125e-1);
+    }
+    {
+        const char str[] = "0x125p-1";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == hexfloat<long double>(0x125, 0, -1));
+    }
+    {
+        const char str[] = "inf";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == INFINITY);
+    }
+    {
+        const char str[] = "INF";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == INFINITY);
+    }
+    {
+        const char str[] = "-inf";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == -INFINITY);
+    }
+    {
+        const char str[] = "-INF";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == -INFINITY);
+    }
+    {
+        const char str[] = "nan";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(std::isnan(v));
+    }
+    {
+        const char str[] = "NAN";
+        hex(ios);
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(std::isnan(v));
+    }
+    {
+        const char str[] = "1.189731495357231765021264e+49321";
+        std::ios_base::iostate err = ios.goodbit;
+        v = 0;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == INFINITY);
+    }
+    {
+        const char str[] = "1.189731495357231765021264e+49329";
+        std::ios_base::iostate err = ios.goodbit;
+        v = 0;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == INFINITY);
+    }
+    {
+        const char str[] = "11.189731495357231765021264e+4932";
+        std::ios_base::iostate err = ios.goodbit;
+        v = 0;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == INFINITY);
+    }
+    {
+        const char str[] = "91.189731495357231765021264e+4932";
+        std::ios_base::iostate err = ios.goodbit;
+        v = 0;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.failbit);
+        assert(v == INFINITY);
+    }
+    {
+        const char str[] = "304888344611713860501504000000";
+        std::ios_base::iostate err = ios.goodbit;
+        v = 0;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err != ios.failbit);
+        assert(v == 304888344611713860501504000000.0L);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_long.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_long.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_long.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_long.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,105 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_get<charT, InputIterator>
+
+// iter_type get(iter_type in, iter_type end, ios_base&,
+//               ios_base::iostate& err, long long& v) const;
+
+#include <locale>
+#include <ios>
+#include <cassert>
+#include <streambuf>
+#include "test_iterators.h"
+
+typedef std::num_get<char, input_iterator<const char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+class my_numpunct
+    : public std::numpunct<char>
+{
+public:
+    my_numpunct() : std::numpunct<char>() {}
+
+protected:
+    virtual char_type do_thousands_sep() const {return '_';}
+    virtual std::string do_grouping() const {return std::string("\1\2\3");}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    long long v = -1;
+    {
+        const char str[] = "0";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 0);
+    }
+    {
+        const char str[] = "1";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 1);
+    }
+    {
+        const char str[] = "-1";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == -1);
+    }
+    hex(ios);
+    {
+        const char str[] = "0x7FFFFFFFFFFFFFFF";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 0x7FFFFFFFFFFFFFFFLL);
+    }
+    {
+        const char str[] = "-0x8000000000000000";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 0x8000000000000000LL);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_pointer.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_get<charT, InputIterator>
+
+// iter_type get(iter_type in, iter_type end, ios_base&,
+//               ios_base::iostate& err, void*& v) const;
+
+#include <locale>
+#include <ios>
+#include <cassert>
+#include <streambuf>
+#include "test_iterators.h"
+
+typedef std::num_get<char, input_iterator<const char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    {
+        const char str[] = "0x0";
+        std::ios_base::iostate err = ios.goodbit;
+        void* p;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, p);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(p == 0);
+    }
+    {
+        const char str[] = "0x73";
+        std::ios_base::iostate err = ios.goodbit;
+        void* p;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, p);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(p == (void*)0x73);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_int.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_int.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_int.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_int.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_get<charT, InputIterator>
+
+// iter_type get(iter_type in, iter_type end, ios_base&,
+//               ios_base::iostate& err, unsigned int& v) const;
+
+#include <locale>
+#include <ios>
+#include <cassert>
+#include <streambuf>
+#include "test_iterators.h"
+
+typedef std::num_get<char, input_iterator<const char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+class my_numpunct
+    : public std::numpunct<char>
+{
+public:
+    my_numpunct() : std::numpunct<char>() {}
+
+protected:
+    virtual char_type do_thousands_sep() const {return '_';}
+    virtual std::string do_grouping() const {return std::string("\1\2\3");}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    unsigned int v = -1;
+    {
+        const char str[] = "0";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 0);
+    }
+    {
+        const char str[] = "1";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 1);
+    }
+    hex(ios);
+    {
+        const char str[] = "0xFFFFFFFF";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 0xFFFFFFFF);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_get<charT, InputIterator>
+
+// iter_type get(iter_type in, iter_type end, ios_base&,
+//               ios_base::iostate& err, unsigned long& v) const;
+
+#include <locale>
+#include <ios>
+#include <cassert>
+#include <streambuf>
+#include "test_iterators.h"
+
+typedef std::num_get<char, input_iterator<const char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+class my_numpunct
+    : public std::numpunct<char>
+{
+public:
+    my_numpunct() : std::numpunct<char>() {}
+
+protected:
+    virtual char_type do_thousands_sep() const {return '_';}
+    virtual std::string do_grouping() const {return std::string("\1\2\3");}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    unsigned long v = -1;
+    {
+        const char str[] = "0";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 0);
+    }
+    {
+        const char str[] = "1";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 1);
+    }
+    hex(ios);
+    {
+        const char str[] = "0xFFFFFFFF";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 0xFFFFFFFF);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long_long.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long_long.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long_long.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long_long.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_get<charT, InputIterator>
+
+// iter_type get(iter_type in, iter_type end, ios_base&,
+//               ios_base::iostate& err, unsigned long long& v) const;
+
+#include <locale>
+#include <ios>
+#include <cassert>
+#include <streambuf>
+#include "test_iterators.h"
+
+typedef std::num_get<char, input_iterator<const char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+class my_numpunct
+    : public std::numpunct<char>
+{
+public:
+    my_numpunct() : std::numpunct<char>() {}
+
+protected:
+    virtual char_type do_thousands_sep() const {return '_';}
+    virtual std::string do_grouping() const {return std::string("\1\2\3");}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    unsigned long long v = -1;
+    {
+        const char str[] = "0";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 0);
+    }
+    {
+        const char str[] = "1";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 1);
+    }
+    hex(ios);
+    {
+        const char str[] = "0xFFFFFFFFFFFFFFFF";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 0xFFFFFFFFFFFFFFFFULL);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_short.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_short.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_short.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_short.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class num_get<charT, InputIterator>
+
+// iter_type get(iter_type in, iter_type end, ios_base&,
+//               ios_base::iostate& err, unsigned short& v) const;
+
+#include <locale>
+#include <ios>
+#include <cassert>
+#include <streambuf>
+#include "test_iterators.h"
+
+typedef std::num_get<char, input_iterator<const char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+class my_numpunct
+    : public std::numpunct<char>
+{
+public:
+    my_numpunct() : std::numpunct<char>() {}
+
+protected:
+    virtual char_type do_thousands_sep() const {return '_';}
+    virtual std::string do_grouping() const {return std::string("\1\2\3");}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    unsigned short v = -1;
+    {
+        const char str[] = "0";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 0);
+    }
+    {
+        const char str[] = "1";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 1);
+    }
+    hex(ios);
+    {
+        const char str[] = "0xFFFF";
+        std::ios_base::iostate err = ios.goodbit;
+        input_iterator<const char*> iter =
+            f.get(input_iterator<const char*>(str),
+                  input_iterator<const char*>(str+sizeof(str)),
+                  ios, err, v);
+        assert(iter.base() == str+sizeof(str)-1);
+        assert(err == ios.goodbit);
+        assert(v == 0xFFFF);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <limits>
+#include <sstream>
+#include <iostream>
+#include <cassert>
+#include <iostream>
+
+using namespace std;
+
+template<typename T>
+void check_limits()
+{
+    T minv = numeric_limits<T>::min();
+    T maxv = numeric_limits<T>::max();
+
+    ostringstream miniss, maxiss;
+    assert(miniss << minv);
+    assert(maxiss << maxv);
+    std::string mins = miniss.str();
+    std::string maxs = maxiss.str(); 
+
+    istringstream maxoss(maxs), minoss(mins);
+
+    T new_minv, new_maxv;
+    assert(maxoss >> new_maxv);
+    assert(minoss >> new_minv);
+ 
+    assert(new_minv == minv);
+    assert(new_maxv == maxv);
+
+    if(mins == "0")
+        mins = "-1";
+    else
+        mins[mins.size() - 1]++;
+    
+    maxs[maxs.size() - 1]++;
+
+    istringstream maxoss2(maxs), minoss2(mins);
+    
+    assert(! (maxoss2 >> new_maxv));
+    assert(! (minoss2 >> new_minv));
+}
+
+int main(void)
+{
+    check_limits<short>();
+    check_limits<unsigned short>();
+    check_limits<int>();
+    check_limits<unsigned int>();
+    check_limits<long>();
+    check_limits<unsigned long>();
+    check_limits<long long>();
+    check_limits<unsigned long long>();
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.virtuals/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.virtuals/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.virtuals/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.virtuals/tested_elsewhere.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/types.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/locale.num.get/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT, class InputIterator = istreambuf_iterator<charT> >
+// class num_get
+//     : public locale::facet
+// {
+// public:
+//     typedef charT char_type;
+//     typedef InputIterator iter_type;
+
+#include <locale>
+#include <iterator>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::locale::facet, std::num_get<char> >::value), "");
+    static_assert((std::is_base_of<std::locale::facet, std::num_get<wchar_t> >::value), "");
+    static_assert((std::is_same<std::num_get<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::num_get<wchar_t>::char_type, wchar_t>::value), "");
+    static_assert((std::is_same<std::num_get<char>::iter_type, std::istreambuf_iterator<char> >::value), "");
+    static_assert((std::is_same<std::num_get<wchar_t>::iter_type, std::istreambuf_iterator<wchar_t> >::value), "");
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.numeric/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.numeric/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.numeric/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.numeric/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/date_order.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/date_order.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/date_order.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/date_order.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class time_get_byname<charT, InputIterator>
+
+// dateorder date_order() const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef std::time_get_byname<char, input_iterator<const char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {}
+};
+
+int main()
+{
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        assert(f.date_order() == std::time_base::mdy);
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.date_order() == std::time_base::dmy);
+    }
+    {
+        const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.date_order() == std::time_base::dmy);
+    }
+    {
+        const my_facet f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.date_order() == std::time_base::ymd);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/date_order_wide.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/date_order_wide.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/date_order_wide.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/date_order_wide.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class time_get_byname<charT, InputIterator>
+
+// dateorder date_order() const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef std::time_get_byname<wchar_t, input_iterator<const wchar_t*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {}
+};
+
+int main()
+{
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        assert(f.date_order() == std::time_base::mdy);
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        assert(f.date_order() == std::time_base::dmy);
+    }
+    {
+        const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+        assert(f.date_order() == std::time_base::dmy);
+    }
+    {
+        const my_facet f(LOCALE_zh_CN_UTF_8, 1);
+        assert(f.date_order() == std::time_base::ymd);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,99 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// GLIBC Expects "10/06/2009" for fr_FR as opposed to "10.06.2009"
+// GLIBC also failes on the zh_CN test.
+// XFAIL: linux
+
+// <locale>
+
+// class time_get_byname<charT, InputIterator>
+
+// iter_type
+// get_date(iter_type s, iter_type end, ios_base& str,
+//          ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef input_iterator<const char*> I;
+
+typedef std::time_get_byname<char, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        const char in[] = "06/10/2009";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_date(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 5);
+        assert(t.tm_mday == 10);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        const char in[] = "10.06.2009";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_date(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 5);
+        assert(t.tm_mday == 10);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+        const char in[] = "10.06.2009";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_date(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 5);
+        assert(t.tm_mday == 10);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+
+    {
+        const my_facet f(LOCALE_zh_CN_UTF_8, 1);
+        const char in[] = "2009/06/10";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_date(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 5);
+        assert(t.tm_mday == 10);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,98 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// GLIBC Expects "10/06/2009" for fr_FR as opposed to "10.06.2009"
+// GLIBC also failes on the zh_CN test.
+// XFAIL: linux
+
+// <locale>
+
+// class time_get_byname<charT, InputIterator>
+
+// iter_type
+// get_date(iter_type s, iter_type end, ios_base& str,
+//          ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef input_iterator<const wchar_t*> I;
+
+typedef std::time_get_byname<wchar_t, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        const wchar_t in[] = L"06/10/2009";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_date(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 5);
+        assert(t.tm_mday == 10);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        const wchar_t in[] = L"10.06.2009";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_date(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 5);
+        assert(t.tm_mday == 10);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+        const wchar_t in[] = L"10.06.2009";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_date(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 5);
+        assert(t.tm_mday == 10);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_zh_CN_UTF_8, 1);
+        const wchar_t in[] = L"2009/06/10";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_date(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 5);
+        assert(t.tm_mday == 10);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,92 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// NOTE: debian and opensuse use old locale data for ru_RU.UTF-8 abreviated
+// months. This locale data was changed in glibc 2.14.
+// Debian uses glibc 2.13 as of 20/11/2014
+// OpenSuse uses glibc 2.19 with old locale data as of 20/11/2014
+// XFAIL: debian, opensuse
+
+// <locale>
+
+// class time_get_byname<charT, InputIterator>
+
+// iter_type
+// get_monthname(iter_type s, iter_type end, ios_base& str,
+//               ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef input_iterator<const char*> I;
+
+typedef std::time_get_byname<char, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        const char in[] = "June";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        const char in[] = "juin";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+        const char in[] = "\xD0\xB8\xD1\x8E\xD0\xBD\xD1\x8F";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_zh_CN_UTF_8, 1);
+        const char in[] = "\xE5\x85\xAD\xE6\x9C\x88";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// NOTE: debian and opensuse use bad locale data for ru_RU.UTF-8 abreviated
+// months. This locale data was fixed in glibc 2.14.
+// Debian uses glibc 2.13 as of 20/11/2014
+// OpenSuse uses glibc 2.19 with old locale data as of 20/11/2014
+// XFAIL: debian, opensuse
+
+// <locale>
+
+// class time_get_byname<charT, InputIterator>
+
+// iter_type
+// get_monthname(iter_type s, iter_type end, ios_base& str,
+//               ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef input_iterator<const wchar_t*> I;
+
+typedef std::time_get_byname<wchar_t, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {}
+};
+
+typedef std::time_put_byname<wchar_t, wchar_t*> F2;
+class my_facet2
+    : public F2
+{
+public:
+    explicit my_facet2(const std::string& nm, std::size_t refs = 0)
+        : F2(nm, refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        const wchar_t in[] = L"June";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        const wchar_t in[] = L"juin";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+        const wchar_t in[] = L"\x438\x44E\x43D\x44F";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_zh_CN_UTF_8, 1);
+        const wchar_t in[] = L"\x516D\x6708";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,168 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class time_get_byname<charT, InputIterator>
+
+// iter_type get(iter_type s, iter_type end, ios_base& f,
+//               ios_base::iostate& err, tm *t, char format, char modifier = 0) const;
+
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef input_iterator<const char*> I;
+
+typedef std::time_get_byname<char, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        const char in[] = "Sat Dec 31 23:55:59 2061";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'c');
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(t.tm_mday == 31);
+        assert(t.tm_mon == 11);
+        assert(t.tm_year == 161);
+        assert(t.tm_wday == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        const char in[] = "23:55:59";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'X');
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        const char in[] = "Sam 31 d""\xC3\xA9""c 23:55:59 2061";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'c');
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(t.tm_mday == 31);
+        assert(t.tm_mon == 11);
+        assert(t.tm_year == 161);
+        assert(t.tm_wday == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        const char in[] = "23:55:59";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'X');
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+        const char in[] = "\xD1\x81\xD1\x83\xD0\xB1\xD0\xB1"
+                          "\xD0\xBE\xD1\x82\xD0\xB0"
+                          ", 31 "
+                          "\xD0\xB4\xD0\xB5\xD0\xBA\xD0\xB0"
+                          "\xD0\xB1\xD1\x80\xD1\x8F"
+                          " 2061 "
+                          "\xD0\xB3"
+                          ". 23:55:59";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'c');
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(t.tm_mday == 31);
+        assert(t.tm_mon == 11);
+        assert(t.tm_year == 161);
+        assert(t.tm_wday == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+        const char in[] = "23:55:59";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'X');
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_zh_CN_UTF_8, 1);
+        const char in[] = "\xE5\x85\xAD"
+                          " 12/31 23:55:59 2061";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'c');
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(t.tm_mday == 31);
+        assert(t.tm_mon == 11);
+        assert(t.tm_year == 161);
+        assert(t.tm_wday == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_zh_CN_UTF_8, 1);
+        const char in[] = "23""\xE6\x97\xB6""55""\xE5\x88\x86""59""\xE7\xA7\x92";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'X');
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,170 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class time_get_byname<charT, InputIterator>
+
+// iter_type get(iter_type s, iter_type end, ios_base& f,
+//               ios_base::iostate& err, tm *t, char format, char modifier = 0) const;
+
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef input_iterator<const wchar_t*> I;
+
+typedef std::time_get_byname<wchar_t, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        const wchar_t in[] = L"Sat Dec 31 23:55:59 2061";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'c');
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(t.tm_mday == 31);
+        assert(t.tm_mon == 11);
+        assert(t.tm_year == 161);
+        assert(t.tm_wday == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        const wchar_t in[] = L"23:55:59";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'X');
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        const wchar_t in[] = L"Sam 31 d""\xE9""c 23:55:59 2061";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'c');
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(t.tm_mday == 31);
+        assert(t.tm_mon == 11);
+        assert(t.tm_year == 161);
+        assert(t.tm_wday == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        const wchar_t in[] = L"23:55:59";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'X');
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(err == std::ios_base::eofbit);
+    }
+#ifdef __APPLE__
+    {
+        const my_facet f("ru_RU", 1);
+        const wchar_t in[] = L"\x441\x443\x431\x431\x43E\x442\x430"
+                          ", 31 "
+                          "\x434\x435\x43A\x430\x431\x440\x44F"
+                          " 2061 "
+                          "\x433"
+                          ". 23:55:59";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'c');
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(t.tm_mday == 31);
+        assert(t.tm_mon == 11);
+        assert(t.tm_year == 161);
+        assert(t.tm_wday == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+#endif
+    {
+        const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+        const wchar_t in[] = L"23:55:59";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'X');
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(err == std::ios_base::eofbit);
+    }
+#ifdef __APPLE__
+    {
+        const my_facet f("zh_CN", 1);
+        const wchar_t in[] = L"\x516D"
+                          " 12/31 23:55:59 2061";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'c');
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(t.tm_mday == 31);
+        assert(t.tm_mon == 11);
+        assert(t.tm_year == 161);
+        assert(t.tm_wday == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+#endif
+    {
+        const my_facet f(LOCALE_zh_CN_UTF_8, 1);
+        const wchar_t in[] = L"23""\x65F6""55""\x5206""59""\x79D2";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'X');
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_time.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_time.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_time.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_time.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,94 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class time_get_byname<charT, InputIterator>
+
+// iter_type
+// get_time(iter_type s, iter_type end, ios_base& str,
+//          ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef input_iterator<const char*> I;
+
+typedef std::time_get_byname<char, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        const char in[] = "13:14:15";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_hour == 13);
+        assert(t.tm_min == 14);
+        assert(t.tm_sec == 15);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        const char in[] = "13:14:15";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_hour == 13);
+        assert(t.tm_min == 14);
+        assert(t.tm_sec == 15);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+        const char in[] = "13:14:15";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_hour == 13);
+        assert(t.tm_min == 14);
+        assert(t.tm_sec == 15);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_zh_CN_UTF_8, 1);
+        const char in[] = "13:14:15";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_hour == 13);
+        assert(t.tm_min == 14);
+        assert(t.tm_sec == 15);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_time_wide.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_time_wide.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_time_wide.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_time_wide.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,94 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class time_get_byname<charT, InputIterator>
+
+// iter_type
+// get_time(iter_type s, iter_type end, ios_base& str,
+//          ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef input_iterator<const wchar_t*> I;
+
+typedef std::time_get_byname<wchar_t, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        const wchar_t in[] = L"13:14:15";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_hour == 13);
+        assert(t.tm_min == 14);
+        assert(t.tm_sec == 15);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        const wchar_t in[] = L"13:14:15";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_hour == 13);
+        assert(t.tm_min == 14);
+        assert(t.tm_sec == 15);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+        const wchar_t in[] = L"13:14:15";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_hour == 13);
+        assert(t.tm_min == 14);
+        assert(t.tm_sec == 15);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_zh_CN_UTF_8, 1);
+        const wchar_t in[] = L"13:14:15";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_hour == 13);
+        assert(t.tm_min == 14);
+        assert(t.tm_sec == 15);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class time_get_byname<charT, InputIterator>
+
+// iter_type
+// get_weekday(iter_type s, iter_type end, ios_base& str,
+//             ios_base::iostate& err, tm* t) const;
+
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef input_iterator<const char*> I;
+
+typedef std::time_get_byname<char, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        const char in[] = "Monday";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        const char in[] = "Lundi";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+        const char in[] = "\xD0\xBF\xD0\xBE\xD0\xBD\xD0\xB5"
+                          "\xD0\xB4\xD0\xB5\xD0\xBB\xD1\x8C"
+                          "\xD0\xBD\xD0\xB8\xD0\xBA";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_zh_CN_UTF_8, 1);
+        const char in[] = "\xE6\x98\x9F\xE6\x9C\x9F\xE4\xB8\x80";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,89 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class time_get_byname<charT, InputIterator>
+
+// iter_type
+// get_weekday(iter_type s, iter_type end, ios_base& str,
+//             ios_base::iostate& err, tm* t) const;
+
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef input_iterator<const wchar_t*> I;
+
+typedef std::time_get_byname<wchar_t, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        const wchar_t in[] = L"Monday";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        const wchar_t in[] = L"Lundi";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+        const wchar_t in[] = L"\x43F\x43E\x43D\x435\x434\x435\x43B\x44C\x43D\x438\x43A";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_zh_CN_UTF_8, 1);
+        const wchar_t in[] = L"\x661F\x671F\x4E00";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_year.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_year.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_year.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_year.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class time_get_byname<charT, InputIterator>
+
+// iter_type get_year(iter_type s, iter_type end, ios_base& str,
+//                    ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef input_iterator<const char*> I;
+
+typedef std::time_get_byname<char, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        const char in[] = "2009";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        const char in[] = "2009";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+        const char in[] = "2009";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_zh_CN_UTF_8, 1);
+        const char in[] = "2009";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_year_wide.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_year_wide.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_year_wide.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_year_wide.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+
+// <locale>
+
+// class time_get_byname<charT, InputIterator>
+
+// iter_type get_year(iter_type s, iter_type end, ios_base& str,
+//                    ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef input_iterator<const wchar_t*> I;
+
+typedef std::time_get_byname<wchar_t, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {}
+};
+
+int main()
+{
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        const wchar_t in[] = L"2009";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        const wchar_t in[] = L"2009";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+        const wchar_t in[] = L"2009";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const my_facet f(LOCALE_zh_CN_UTF_8, 1);
+        const wchar_t in[] = L"2009";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/ctor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/ctor.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/ctor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_get<charT, InputIterator>
+
+// explicit time_get(size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+typedef std::time_get<char, const char*> F;
+
+class my_facet
+    : public F
+{
+public:
+    static int count;
+
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet);
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/date_order.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/date_order.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/date_order.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/date_order.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_get<charT, InputIterator>
+
+// dateorder date_order() const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+typedef std::time_get<char, input_iterator<const char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    assert(f.date_order() == std::time_base::mdy);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_date.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_date.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_date.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_date.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_get<charT, InputIterator>
+
+// iter_type
+// get_date(iter_type s, iter_type end, ios_base& str,
+//          ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+typedef input_iterator<const char*> I;
+
+typedef std::time_get<char, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const char in[] = "5/5/5";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_date(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_mon == 4);
+        assert(t.tm_mday == 5);
+        assert(t.tm_year == 105);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_date_wide.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_date_wide.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_date_wide.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_date_wide.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_get<charT, InputIterator>
+
+// iter_type
+// get_date(iter_type s, iter_type end, ios_base& str,
+//          ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+typedef input_iterator<const wchar_t*> I;
+
+typedef std::time_get<wchar_t, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const wchar_t in[] = L"5/5/5";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_date(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_mon == 4);
+        assert(t.tm_mday == 5);
+        assert(t.tm_year == 105);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_many.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_many.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_many.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_many.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_get<charT, InputIterator>
+
+// iter_type
+// get(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err, tm *t,
+//     const char_type *fmt, const char_type *fmtend) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+typedef input_iterator<const char*> I;
+
+typedef std::time_get<char, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const char in[] = "2009 May 9, 10:27pm";
+        const char fmt[] = "%Y %b %d, %I:%M%p";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, fmt, fmt+sizeof(fmt)-1);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_year == 109);
+        assert(t.tm_mon == 4);
+        assert(t.tm_mday == 9);
+        assert(t.tm_hour == 22);
+        assert(t.tm_min == 27);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "10:27PM May 9, 2009";
+        const char fmt[] = "%I:%M%p %b %d, %Y";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, fmt, fmt+sizeof(fmt)-1);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_year == 109);
+        assert(t.tm_mon == 4);
+        assert(t.tm_mday == 9);
+        assert(t.tm_hour == 22);
+        assert(t.tm_min == 27);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_monthname.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_monthname.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_monthname.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_monthname.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,265 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_get<charT, InputIterator>
+
+// iter_type
+// get_monthname(iter_type s, iter_type end, ios_base& str,
+//               ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+typedef input_iterator<const char*> I;
+
+typedef std::time_get<char, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const char in[] = "Jan";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 0);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Feb";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Mar";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 2);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Apr";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 3);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "May";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 4);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Jun";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Jul";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Aug";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 7);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Sep";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 8);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Oct";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 9);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Nov";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 10);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Dec";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 11);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "January";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+7);
+        assert(t.tm_mon == 0);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "February";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+8);
+        assert(t.tm_mon == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "March";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+5);
+        assert(t.tm_mon == 2);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "April";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+5);
+        assert(t.tm_mon == 3);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "May";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 4);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "June";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+4);
+        assert(t.tm_mon == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "July";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+4);
+        assert(t.tm_mon == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "August";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+6);
+        assert(t.tm_mon == 7);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "September";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+9);
+        assert(t.tm_mon == 8);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "October";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+7);
+        assert(t.tm_mon == 9);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "November";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+8);
+        assert(t.tm_mon == 10);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "December";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+8);
+        assert(t.tm_mon == 11);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Decemper";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+5);
+        assert(t.tm_mon == 0);
+        assert(err == std::ios_base::failbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_monthname_wide.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_monthname_wide.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_monthname_wide.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_monthname_wide.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,265 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_get<charT, InputIterator>
+
+// iter_type
+// get_monthname(iter_type s, iter_type end, ios_base& str,
+//               ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+typedef input_iterator<const wchar_t*> I;
+
+typedef std::time_get<wchar_t, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const wchar_t in[] = L"Jan";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 0);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Feb";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Mar";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 2);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Apr";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 3);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"May";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 4);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Jun";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Jul";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Aug";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 7);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Sep";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 8);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Oct";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 9);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Nov";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 10);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Dec";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 11);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"January";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+7);
+        assert(t.tm_mon == 0);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"February";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+8);
+        assert(t.tm_mon == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"March";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+5);
+        assert(t.tm_mon == 2);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"April";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+5);
+        assert(t.tm_mon == 3);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"May";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_mon == 4);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"June";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+4);
+        assert(t.tm_mon == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"July";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+4);
+        assert(t.tm_mon == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"August";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+6);
+        assert(t.tm_mon == 7);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"September";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+9);
+        assert(t.tm_mon == 8);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"October";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+7);
+        assert(t.tm_mon == 9);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"November";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+8);
+        assert(t.tm_mon == 10);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"December";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+8);
+        assert(t.tm_mon == 11);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Decemper";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_monthname(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+5);
+        assert(t.tm_mon == 0);
+        assert(err == std::ios_base::failbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_one.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_one.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_one.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_one.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,305 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_get<charT, InputIterator>
+
+// iter_type get(iter_type s, iter_type end, ios_base& f,
+//               ios_base::iostate& err, tm *t, char format, char modifier = 0) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+typedef input_iterator<const char*> I;
+
+typedef std::time_get<char, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const char in[] = "mon";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'a');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "wednesdaY";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'A');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_wday == 3);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "June";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'b');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_mon == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Jul";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'B');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_mon == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Thu Jun  6 09:49:10 2009";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'c');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_wday == 4);
+        assert(t.tm_mon == 5);
+        assert(t.tm_mday == 6);
+        assert(t.tm_hour == 9);
+        assert(t.tm_min == 49);
+        assert(t.tm_sec == 10);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "11";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'd');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_mday == 11);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "2/1/1";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'D');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_mon == 1);
+        assert(t.tm_mday == 1);
+        assert(t.tm_year == 101);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "11";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'e');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_mday == 11);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "June";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'h');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_mon == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "19";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'H');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_hour == 19);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "12";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'm');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_mon == 11);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "59";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'M');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_min == 59);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "\t\n ";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'n');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "09:49:10 PM";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'r');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_hour == 21);
+        assert(t.tm_min == 49);
+        assert(t.tm_sec == 10);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "09:49:10 AM";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'r');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_hour == 9);
+        assert(t.tm_min == 49);
+        assert(t.tm_sec == 10);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "12:49:10 AM";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'r');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_hour == 0);
+        assert(t.tm_min == 49);
+        assert(t.tm_sec == 10);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "12:49:10 PM";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'r');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_hour == 12);
+        assert(t.tm_min == 49);
+        assert(t.tm_sec == 10);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "09:49";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'R');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_hour == 9);
+        assert(t.tm_min == 49);
+        assert(t.tm_sec == 0);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "60";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'S');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_hour == 0);
+        assert(t.tm_min == 0);
+        assert(t.tm_sec == 60);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "\t\n ";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 't');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "21:49:10";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'T');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_hour == 21);
+        assert(t.tm_min == 49);
+        assert(t.tm_sec == 10);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "3";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'w');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_wday == 3);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "06/06/09";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'x');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_mon == 5);
+        assert(t.tm_mday == 6);
+        assert(t.tm_year == 109);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "21:49:10";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'X');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_hour == 21);
+        assert(t.tm_min == 49);
+        assert(t.tm_sec == 10);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "68";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'y');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_year == 168);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "68";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, 'Y');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_year == -1832);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "%";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get(I(in), I(in+sizeof(in)-1), ios, err, &t, '%');
+        assert(i.base() == in+sizeof(in)-1);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_time.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_time.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_time.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_time.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,117 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_get<charT, InputIterator>
+
+// iter_type
+// get_time(iter_type s, iter_type end, ios_base& str,
+//          ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+typedef input_iterator<const char*> I;
+
+typedef std::time_get<char, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const char in[] = "0:0:0";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_hour == 0);
+        assert(t.tm_min == 0);
+        assert(t.tm_sec == 0);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "23:59:60";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_hour == 23);
+        assert(t.tm_min == 59);
+        assert(t.tm_sec == 60);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "24:59:60";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+2);
+        assert(t.tm_hour == 0);
+        assert(t.tm_min == 0);
+        assert(t.tm_sec == 0);
+        assert(err == std::ios_base::failbit);
+    }
+    {
+        const char in[] = "23:60:60";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+5);
+//         assert(t.tm_hour == 0);
+//         assert(t.tm_min == 0);
+//         assert(t.tm_sec == 0);
+        assert(err == std::ios_base::failbit);
+    }
+    {
+        const char in[] = "23:59:61";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+8);
+//         assert(t.tm_hour == 0);
+//         assert(t.tm_min == 0);
+//         assert(t.tm_sec == 0);
+        assert(err == (std::ios_base::failbit | std::ios_base::eofbit));
+    }
+    {
+        const char in[] = "2:43:221";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+7);
+        assert(t.tm_hour == 2);
+        assert(t.tm_min == 43);
+        assert(t.tm_sec == 22);
+        assert(err == std::ios_base::goodbit);
+    }
+    {
+        const char in[] = "2.43:221";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+1);
+//         assert(t.tm_hour == 0);
+//         assert(t.tm_min == 0);
+//         assert(t.tm_sec == 0);
+        assert(err == std::ios_base::failbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_time_wide.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_time_wide.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_time_wide.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_time_wide.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,117 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_get<charT, InputIterator>
+
+// iter_type
+// get_time(iter_type s, iter_type end, ios_base& str,
+//          ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+typedef input_iterator<const wchar_t*> I;
+
+typedef std::time_get<wchar_t, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const wchar_t in[] = L"0:0:0";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_hour == 0);
+        assert(t.tm_min == 0);
+        assert(t.tm_sec == 0);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"23:59:60";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)/sizeof(in[0])-1);
+        assert(t.tm_hour == 23);
+        assert(t.tm_min == 59);
+        assert(t.tm_sec == 60);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"24:59:60";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+2);
+        assert(t.tm_hour == 0);
+        assert(t.tm_min == 0);
+        assert(t.tm_sec == 0);
+        assert(err == std::ios_base::failbit);
+    }
+    {
+        const wchar_t in[] = L"23:60:60";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+5);
+//         assert(t.tm_hour == 0);
+//         assert(t.tm_min == 0);
+//         assert(t.tm_sec == 0);
+        assert(err == std::ios_base::failbit);
+    }
+    {
+        const wchar_t in[] = L"23:59:61";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+8);
+//         assert(t.tm_hour == 0);
+//         assert(t.tm_min == 0);
+//         assert(t.tm_sec == 0);
+        assert(err == (std::ios_base::failbit | std::ios_base::eofbit));
+    }
+    {
+        const wchar_t in[] = L"2:43:221";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+7);
+        assert(t.tm_hour == 2);
+        assert(t.tm_min == 43);
+        assert(t.tm_sec == 22);
+        assert(err == std::ios_base::goodbit);
+    }
+    {
+        const wchar_t in[] = L"2.43:221";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_time(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+1);
+//         assert(t.tm_hour == 0);
+//         assert(t.tm_min == 0);
+//         assert(t.tm_sec == 0);
+        assert(err == std::ios_base::failbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_weekday.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_weekday.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_weekday.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_weekday.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,220 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_get<charT, InputIterator>
+
+// iter_type
+// get_weekday(iter_type s, iter_type end, ios_base& str,
+//             ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+typedef input_iterator<const char*> I;
+
+typedef std::time_get<char, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const char in[] = "Sun";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 0);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Suny";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 0);
+        assert(err == std::ios_base::goodbit);
+    }
+    {
+        const char in[] = "Sund";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+4);
+        assert(t.tm_wday == 0);
+        assert(err == (std::ios_base::failbit | std::ios_base::eofbit));
+    }
+    {
+        const char in[] = "sun";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 0);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "sunday";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+6);
+        assert(t.tm_wday == 0);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Mon";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Mony";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::goodbit);
+    }
+    {
+        const char in[] = "Mond";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+4);
+        assert(t.tm_wday == 0);
+        assert(err == (std::ios_base::failbit | std::ios_base::eofbit));
+    }
+    {
+        const char in[] = "mon";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "monday";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+6);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Tue";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 2);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Tuesday";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+7);
+        assert(t.tm_wday == 2);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Wed";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 3);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Wednesday";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+9);
+        assert(t.tm_wday == 3);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Thu";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 4);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Thursday";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+8);
+        assert(t.tm_wday == 4);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Fri";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Friday";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+6);
+        assert(t.tm_wday == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Sat";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "Saturday";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+8);
+        assert(t.tm_wday == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_weekday_wide.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_weekday_wide.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_weekday_wide.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_weekday_wide.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,220 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_get<charT, InputIterator>
+
+// iter_type
+// get_weekday(iter_type s, iter_type end, ios_base& str,
+//             ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+typedef input_iterator<const wchar_t*> I;
+
+typedef std::time_get<wchar_t, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const wchar_t in[] = L"Sun";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 0);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Suny";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 0);
+        assert(err == std::ios_base::goodbit);
+    }
+    {
+        const wchar_t in[] = L"Sund";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+4);
+        assert(t.tm_wday == 0);
+        assert(err == (std::ios_base::failbit | std::ios_base::eofbit));
+    }
+    {
+        const wchar_t in[] = L"sun";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 0);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"sunday";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+6);
+        assert(t.tm_wday == 0);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Mon";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Mony";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::goodbit);
+    }
+    {
+        const wchar_t in[] = L"Mond";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+4);
+        assert(t.tm_wday == 0);
+        assert(err == (std::ios_base::failbit | std::ios_base::eofbit));
+    }
+    {
+        const wchar_t in[] = L"mon";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"monday";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+6);
+        assert(t.tm_wday == 1);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Tue";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 2);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Tuesday";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+7);
+        assert(t.tm_wday == 2);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Wed";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 3);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Wednesday";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+9);
+        assert(t.tm_wday == 3);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Thu";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 4);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Thursday";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+8);
+        assert(t.tm_wday == 4);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Fri";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Friday";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+6);
+        assert(t.tm_wday == 5);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Sat";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+3);
+        assert(t.tm_wday == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const wchar_t in[] = L"Saturday";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
+        assert(i.base() == in+8);
+        assert(t.tm_wday == 6);
+        assert(err == std::ios_base::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_year.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_year.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_year.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_year.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,138 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_get<charT, InputIterator>
+
+// iter_type get_year(iter_type s, iter_type end, ios_base& str,
+//                    ios_base::iostate& err, tm* t) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+typedef input_iterator<const char*> I;
+
+typedef std::time_get<char, I> F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    std::ios ios(0);
+    std::ios_base::iostate err;
+    std::tm t;
+    {
+        const char in[] = "0";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_year == 100);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "00";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_year == 100);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "1";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_year == 101);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "68";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_year == 168);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "69";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_year == 69);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "99";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_year == 99);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "100";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_year == -1800);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "1900";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_year == 0);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "1968";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_year == 68);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "2000";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-1);
+        assert(t.tm_year == 100);
+        assert(err == std::ios_base::eofbit);
+    }
+    {
+        const char in[] = "2999c";
+        err = std::ios_base::goodbit;
+        t = std::tm();
+        I i = f.get_year(I(in), I(in+sizeof(in)-1), ios, err, &t);
+        assert(i.base() == in+sizeof(in)-2);
+        assert(t.tm_year == 1099);
+        assert(err == std::ios_base::goodbit);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.virtuals/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.virtuals/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.virtuals/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/locale.time.get.virtuals/tested_elsewhere.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_base
+// {
+// public:
+//     enum dateorder {no_order, dmy, mdy, ymd, ydm};
+// };
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::time_base::dateorder d = std::time_base::no_order;
+    assert(std::time_base::no_order == 0);
+    assert(std::time_base::dmy == 1);
+    assert(std::time_base::mdy == 2);
+    assert(std::time_base::ymd == 3);
+    assert(std::time_base::ydm == 4);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/types.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_base
+// {
+// public:
+//     enum dateorder {no_order, dmy, mdy, ymd, ydm};
+// };
+//
+// template <class charT, class InputIterator = istreambuf_iterator<charT> >
+// class time_get
+//     : public locale::facet,
+//       public time_base
+// {
+// public:
+//     typedef charT         char_type;
+//     typedef InputIterator iter_type;
+
+#include <locale>
+#include <iterator>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::locale::facet, std::time_get<char> >::value), "");
+    static_assert((std::is_base_of<std::locale::facet, std::time_get<wchar_t> >::value), "");
+    static_assert((std::is_base_of<std::time_base, std::time_get<char> >::value), "");
+    static_assert((std::is_base_of<std::time_base, std::time_get<wchar_t> >::value), "");
+    static_assert((std::is_same<std::time_get<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::time_get<wchar_t>::char_type, wchar_t>::value), "");
+    static_assert((std::is_same<std::time_get<char>::iter_type, std::istreambuf_iterator<char> >::value), "");
+    static_assert((std::is_same<std::time_get<wchar_t>::iter_type, std::istreambuf_iterator<wchar_t> >::value), "");
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+
+// <locale>
+
+// template <class CharT, class OutputIterator = ostreambuf_iterator<CharT> >
+// class time_put_byname
+//     : public time_put<CharT, OutputIterator>
+// {
+// public:
+//     explicit time_put_byname(const char* nm, size_t refs = 0);
+//     explicit time_put_byname(const string& nm, size_t refs = 0);
+//
+// protected:
+//     ~time_put_byname();
+// };
+
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+#include "platform_support.h" // locale name macros
+
+typedef std::time_put_byname<char, output_iterator<char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(const std::string& nm, std::size_t refs = 0)
+        : F(nm, refs) {}
+};
+
+int main()
+{
+    char str[200];
+    output_iterator<char*> iter;
+    tm t;
+    t.tm_sec = 6;
+    t.tm_min = 3;
+    t.tm_hour = 13;
+    t.tm_mday = 2;
+    t.tm_mon = 4;
+    t.tm_year = 109;
+    t.tm_wday = 6;
+    t.tm_yday = -1;
+    t.tm_isdst = 1;
+    std::ios ios(0);
+    {
+        const my_facet f(LOCALE_en_US_UTF_8, 1);
+        std::string pat("Today is %A which is abbreviated %a.");
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t,
+                     pat.data(), pat.data() + pat.size());
+        std::string ex(str, iter.base());
+        assert(ex == "Today is Saturday which is abbreviated Sat.");
+    }
+    {
+        const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+        std::string pat("Today is %A which is abbreviated %a.");
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t,
+                     pat.data(), pat.data() + pat.size());
+        std::string ex(str, iter.base());
+        assert((ex == "Today is Samedi which is abbreviated Sam.")||
+               (ex == "Today is samedi which is abbreviated sam." ));
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/ctor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/ctor.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/ctor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_put<charT, OutputIterator>
+
+// explicit time_put(size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+typedef std::time_put<char, char*> F;
+
+class my_facet
+    : public F
+{
+public:
+    static int count;
+
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet);
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+    {
+        my_facet f(1);
+        assert(my_facet::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet::count == 1);
+        }
+        assert(my_facet::count == 1);
+    }
+    assert(my_facet::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put1.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_put<charT, OutputIterator>
+
+// iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
+//               const charT* pattern, const charT* pat_end) const;
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+typedef std::time_put<char, output_iterator<char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    char str[200];
+    output_iterator<char*> iter;
+    tm t;
+    t.tm_sec = 6;
+    t.tm_min = 3;
+    t.tm_hour = 13;
+    t.tm_mday = 2;
+    t.tm_mon = 4;
+    t.tm_year = 109;
+    t.tm_wday = 6;
+    t.tm_yday = -1;
+    t.tm_isdst = 1;
+    std::ios ios(0);
+    {
+        std::string pat("Today is %A which is abbreviated %a.");
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t,
+                     pat.data(), pat.data() + pat.size());
+        std::string ex(str, iter.base());
+        assert(ex == "Today is Saturday which is abbreviated Sat.");
+    }
+    {
+        std::string pat("The number of the month is %Om.");
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t,
+                     pat.data(), pat.data() + pat.size());
+        std::string ex(str, iter.base());
+        assert(ex == "The number of the month is 05.");
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,370 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class time_put<charT, OutputIterator>
+
+// iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
+//               char format, char modifier = 0) const;
+
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
+#include <locale>
+#include <cassert>
+#include "test_iterators.h"
+
+typedef std::time_put<char, output_iterator<char*> > F;
+
+class my_facet
+    : public F
+{
+public:
+    explicit my_facet(std::size_t refs = 0)
+        : F(refs) {}
+};
+
+int main()
+{
+    const my_facet f(1);
+    char str[200];
+    output_iterator<char*> iter;
+    tm t = {0};
+    t.tm_sec = 6;
+    t.tm_min = 3;
+    t.tm_hour = 13;
+    t.tm_mday = 2;
+    t.tm_mon = 4;
+    t.tm_year = 109;
+    t.tm_wday = 6;
+    t.tm_yday = -1;
+    t.tm_isdst = 1;
+    std::ios ios(0);
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'A');
+        std::string ex(str, iter.base());
+        assert(ex == "Saturday");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'a');
+        std::string ex(str, iter.base());
+        assert(ex == "Sat");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'B');
+        std::string ex(str, iter.base());
+        assert(ex == "May");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'b');
+        std::string ex(str, iter.base());
+        assert(ex == "May");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'C');
+        std::string ex(str, iter.base());
+        assert(ex == "20");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'c');
+        std::string ex(str, iter.base());
+        assert(ex == "Sat May  2 13:03:06 2009");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'D');
+        std::string ex(str, iter.base());
+        assert(ex == "05/02/09");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'd');
+        std::string ex(str, iter.base());
+        assert(ex == "02");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'c', 'E');
+        std::string ex(str, iter.base());
+        assert(ex == "Sat May  2 13:03:06 2009");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'C', 'E');
+        std::string ex(str, iter.base());
+        assert(ex == "20");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'x', 'E');
+        std::string ex(str, iter.base());
+        assert(ex == "05/02/09");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'X', 'E');
+        std::string ex(str, iter.base());
+        assert(ex == "13:03:06");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'y', 'E');
+        std::string ex(str, iter.base());
+        assert(ex == "09");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'Y', 'E');
+        std::string ex(str, iter.base());
+        assert(ex == "2009");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'd', 'O');
+        std::string ex(str, iter.base());
+        assert(ex == "02");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'e', 'O');
+        std::string ex(str, iter.base());
+        assert(ex == " 2");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'H', 'O');
+        std::string ex(str, iter.base());
+        assert(ex == "13");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'I', 'O');
+        std::string ex(str, iter.base());
+        assert(ex == "01");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'm', 'O');
+        std::string ex(str, iter.base());
+        assert(ex == "05");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'M', 'O');
+        std::string ex(str, iter.base());
+        assert(ex == "03");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'S', 'O');
+        std::string ex(str, iter.base());
+        assert(ex == "06");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'u', 'O');
+        std::string ex(str, iter.base());
+        assert(ex == "6");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'U', 'O');
+        std::string ex(str, iter.base());
+        assert(ex == "00");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'V', 'O');
+        std::string ex(str, iter.base());
+        assert(ex == "52");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'w', 'O');
+        std::string ex(str, iter.base());
+        assert(ex == "6");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'W', 'O');
+        std::string ex(str, iter.base());
+        assert(ex == "00");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'y', 'O');
+        std::string ex(str, iter.base());
+        assert(ex == "09");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'B', 'O');
+        std::string ex(str, iter.base());
+        assert(ex == "May");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'e');
+        std::string ex(str, iter.base());
+        assert(ex == " 2");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'F');
+        std::string ex(str, iter.base());
+        assert(ex == "2009-05-02");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'G');
+        std::string ex(str, iter.base());
+        assert(ex == "2008");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'g');
+        std::string ex(str, iter.base());
+        assert(ex == "08");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'H');
+        std::string ex(str, iter.base());
+        assert(ex == "13");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'h');
+        std::string ex(str, iter.base());
+        assert(ex == "May");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'I');
+        std::string ex(str, iter.base());
+        assert(ex == "01");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'j');
+        std::string ex(str, iter.base());
+        assert(ex == "000");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'k');
+        std::string ex(str, iter.base());
+        assert(ex == "13");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'l');
+        std::string ex(str, iter.base());
+        assert(ex == " 1");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'M');
+        std::string ex(str, iter.base());
+        assert(ex == "03");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'm');
+        std::string ex(str, iter.base());
+        assert(ex == "05");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'n');
+        std::string ex(str, iter.base());
+        assert(ex == "\n");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'p');
+        std::string ex(str, iter.base());
+        assert(ex == "PM");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'R');
+        std::string ex(str, iter.base());
+        assert(ex == "13:03");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'r');
+        std::string ex(str, iter.base());
+        assert(ex == "01:03:06 PM");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'S');
+        std::string ex(str, iter.base());
+        assert(ex == "06");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 's');
+        std::string ex(str, iter.base());
+//        assert(ex == "1241283786");  depends on time zone
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'T');
+        std::string ex(str, iter.base());
+        assert(ex == "13:03:06");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 't');
+        std::string ex(str, iter.base());
+        assert(ex == "\t");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'U');
+        std::string ex(str, iter.base());
+        assert(ex == "00");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'u');
+        std::string ex(str, iter.base());
+        assert(ex == "6");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'V');
+        std::string ex(str, iter.base());
+        assert(ex == "52");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'v');
+        std::string ex(str, iter.base());
+        assert(ex == " 2-May-2009");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'W');
+        std::string ex(str, iter.base());
+        assert(ex == "00");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'w');
+        std::string ex(str, iter.base());
+        assert(ex == "6");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'X');
+        std::string ex(str, iter.base());
+        assert(ex == "13:03:06");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'x');
+        std::string ex(str, iter.base());
+        assert(ex == "05/02/09");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'Y');
+        std::string ex(str, iter.base());
+        assert(ex == "2009");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'y');
+        std::string ex(str, iter.base());
+        assert(ex == "09");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'Z');
+        std::string ex(str, iter.base());
+//        assert(ex == "EDT");  depends on time zone
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'z');
+        std::string ex(str, iter.base());
+//        assert(ex == "-0400");  depends on time zone
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, '+');
+        std::string ex(str, iter.base());
+//        assert(ex == "Sat May  2 13:03:06 EDT 2009");  depends on time zone
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, '%');
+        std::string ex(str, iter.base());
+        assert(ex == "%");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, '%', 'J');
+        std::string ex(str, iter.base());
+        assert(ex == "J%");
+    }
+    {
+        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'J');
+        std::string ex(str, iter.base());
+        assert(ex == "J");
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.virtuals/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.virtuals/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.virtuals/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.virtuals/tested_elsewhere.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/types.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT, class OutputIterator = ostreambuf_iterator<charT> >
+// class time_put
+//     : public locale::facet
+// {
+// public:
+//     typedef charT          char_type;
+//     typedef OutputIterator iter_type;
+
+#include <locale>
+#include <iterator>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::locale::facet, std::time_put<char> >::value), "");
+    static_assert((std::is_base_of<std::locale::facet, std::time_put<wchar_t> >::value), "");
+    static_assert((std::is_same<std::time_put<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::time_put<wchar_t>::char_type, wchar_t>::value), "");
+    static_assert((std::is_same<std::time_put<char>::iter_type, std::ostreambuf_iterator<char> >::value), "");
+    static_assert((std::is_same<std::time_put<wchar_t>::iter_type, std::ostreambuf_iterator<wchar_t> >::value), "");
+}

Added: libcxx/trunk/test/std/localization/locale.categories/category.time/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/decimal_point.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/decimal_point.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/decimal_point.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/decimal_point.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+
+// <locale>
+
+// template <class charT> class numpunct_byname;
+
+// char_type decimal_point() const;
+
+#include <locale>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l("C");
+        {
+            typedef char C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.decimal_point() == '.');
+        }
+        {
+            typedef wchar_t C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.decimal_point() == L'.');
+        }
+    }
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef char C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.decimal_point() == '.');
+        }
+        {
+            typedef wchar_t C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.decimal_point() == L'.');
+        }
+    }
+    {
+        std::locale l(LOCALE_fr_FR_UTF_8);
+        {
+            typedef char C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.decimal_point() == ',');
+        }
+        {
+            typedef wchar_t C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.decimal_point() == L',');
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+
+// <locale>
+
+// template <class charT> class numpunct_byname;
+
+// string grouping() const;
+
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
+#include <locale>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l("C");
+        {
+            typedef char C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.grouping() == "");
+        }
+        {
+            typedef wchar_t C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.grouping() == "");
+        }
+    }
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef char C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.grouping() == "\3\3");
+        }
+        {
+            typedef wchar_t C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.grouping() == "\3\3");
+        }
+    }
+    {
+        std::locale l(LOCALE_fr_FR_UTF_8);
+        {
+            typedef char C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.grouping() == "\x7F");
+        }
+        {
+            typedef wchar_t C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.grouping() == "\x7F");
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+
+// <locale>
+
+// template <class charT> class numpunct_byname;
+
+// char_type thousands_sep() const;
+
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
+#include <locale>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale l("C");
+        {
+            typedef char C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.thousands_sep() == ',');
+        }
+        {
+            typedef wchar_t C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.thousands_sep() == L',');
+        }
+    }
+    {
+        std::locale l(LOCALE_en_US_UTF_8);
+        {
+            typedef char C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.thousands_sep() == ',');
+        }
+        {
+            typedef wchar_t C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.thousands_sep() == L',');
+        }
+    }
+    {
+        std::locale l(LOCALE_fr_FR_UTF_8);
+        {
+            typedef char C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.thousands_sep() == ',');
+        }
+        {
+            typedef wchar_t C;
+            const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+            assert(np.thousands_sep() == L',');
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/ctor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/ctor.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/ctor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class numpunct;
+
+// explicit numpunct(size_t refs = 0);
+
+#include <locale>
+#include <cassert>
+
+template <class C>
+class my_facet
+    : public std::numpunct<C>
+{
+public:
+    static int count;
+
+    explicit my_facet(std::size_t refs = 0)
+        : std::numpunct<C>(refs) {++count;}
+
+    ~my_facet() {--count;}
+};
+
+template <class C> int my_facet<C>::count = 0;
+
+int main()
+{
+    {
+        std::locale l(std::locale::classic(), new my_facet<char>);
+        assert(my_facet<char>::count == 1);
+    }
+    assert(my_facet<char>::count == 0);
+    {
+        my_facet<char> f(1);
+        assert(my_facet<char>::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet<char>::count == 1);
+        }
+        assert(my_facet<char>::count == 1);
+    }
+    assert(my_facet<char>::count == 0);
+    {
+        std::locale l(std::locale::classic(), new my_facet<wchar_t>);
+        assert(my_facet<wchar_t>::count == 1);
+    }
+    assert(my_facet<wchar_t>::count == 0);
+    {
+        my_facet<wchar_t> f(1);
+        assert(my_facet<wchar_t>::count == 1);
+        {
+            std::locale l(std::locale::classic(), &f);
+            assert(my_facet<wchar_t>::count == 1);
+        }
+        assert(my_facet<wchar_t>::count == 1);
+    }
+    assert(my_facet<wchar_t>::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/decimal_point.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/decimal_point.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/decimal_point.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/decimal_point.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class numpunct;
+
+// char_type decimal_point() const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef char C;
+        const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+        assert(np.decimal_point() == '.');
+    }
+    {
+        typedef wchar_t C;
+        const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+        assert(np.decimal_point() == L'.');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/falsename.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/falsename.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/falsename.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/falsename.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class numpunct;
+
+// string_type falsename() const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef char C;
+        const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+        assert(np.falsename() == std::string("false"));
+    }
+    {
+        typedef wchar_t C;
+        const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+        assert(np.falsename() == std::wstring(L"false"));
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/grouping.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/grouping.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/grouping.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/grouping.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class numpunct;
+
+// string grouping() const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef char C;
+        const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+        assert(np.grouping() == std::string());
+    }
+    {
+        typedef wchar_t C;
+        const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+        assert(np.grouping() == std::string());
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/thousands_sep.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/thousands_sep.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/thousands_sep.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/thousands_sep.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class numpunct;
+
+// char_type thousands_sep() const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef char C;
+        const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+        assert(np.thousands_sep() == ',');
+    }
+    {
+        typedef wchar_t C;
+        const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+        assert(np.thousands_sep() == L',');
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/truename.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/truename.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/truename.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.members/truename.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> class numpunct;
+
+// string_type truename() const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        typedef char C;
+        const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+        assert(np.truename() == std::string("true"));
+    }
+    {
+        typedef wchar_t C;
+        const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+        assert(np.truename() == std::wstring(L"true"));
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.virtuals/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.virtuals/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.virtuals/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/facet.numpunct.virtuals/tested_elsewhere.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT>
+// class numpunct
+//     : public locale::facet
+// {
+// public:
+//     typedef charT char_type;
+//     typedef basic_string<charT> string_type;
+//     static locale::id id;
+
+#include <locale>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    std::locale l = std::locale::classic();
+    {
+        assert(std::has_facet<std::numpunct<char> >(l));
+        const std::numpunct<char>& f = std::use_facet<std::numpunct<char> >(l);
+        {
+            (void)std::numpunct<char>::id;
+        }
+        static_assert((std::is_same<std::numpunct<char>::char_type, char>::value), "");
+        static_assert((std::is_same<std::numpunct<char>::string_type, std::string>::value), "");
+        static_assert((std::is_base_of<std::locale::facet, std::numpunct<char> >::value), "");
+    }
+    {
+        assert(std::has_facet<std::numpunct<wchar_t> >(l));
+        const std::numpunct<wchar_t>& f = std::use_facet<std::numpunct<wchar_t> >(l);
+        {
+            (void)std::numpunct<wchar_t>::id;
+        }
+        static_assert((std::is_same<std::numpunct<wchar_t>::char_type, wchar_t>::value), "");
+        static_assert((std::is_same<std::numpunct<wchar_t>::string_type, std::wstring>::value), "");
+        static_assert((std::is_base_of<std::locale::facet, std::numpunct<wchar_t> >::value), "");
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/facet.numpunct/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.categories/facets.examples/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/facets.examples/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/facets.examples/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.categories/facets.examples/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_mode.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_mode.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_mode.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_mode.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// enum codecvt_mode
+// {
+//     consume_header = 4,
+//     generate_header = 2,
+//     little_endian = 1
+// };
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    assert(std::consume_header == 4);
+    assert(std::generate_header == 2);
+    assert(std::little_endian == 1);
+    std::codecvt_mode e = std::consume_header;
+    assert(e == 4);
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf16
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// UNSUPPORTED: asan, msan
+
+// Not a portable test
+
+#include <codecvt>
+#include <cstdlib>
+#include <cassert>
+
+int outstanding_news = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++outstanding_news;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    if (p)
+    {
+        --outstanding_news;
+        std::free(p);
+    }
+}
+
+int main()
+{
+    assert(outstanding_news == 0);
+    {
+        typedef std::codecvt_utf16<wchar_t> C;
+        C c;
+        assert(outstanding_news == 0);
+    }
+    {
+        typedef std::codecvt_utf16<wchar_t> C;
+        std::locale loc(std::locale::classic(), new C);
+        assert(outstanding_news != 0);
+    }
+    assert(outstanding_news == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_always_noconv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_always_noconv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_always_noconv.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_always_noconv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf16
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// bool always_noconv() const throw();
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf16<wchar_t> C;
+        C c;
+        bool r = c.always_noconv();
+        assert(r == false);
+    }
+    {
+        typedef std::codecvt_utf16<char16_t> C;
+        C c;
+        bool r = c.always_noconv();
+        assert(r == false);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t> C;
+        C c;
+        bool r = c.always_noconv();
+        assert(r == false);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_encoding.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_encoding.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_encoding.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_encoding.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf16
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// int encoding() const throw();
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf16<wchar_t> C;
+        C c;
+        int r = c.encoding();
+        assert(r == 0);
+    }
+    {
+        typedef std::codecvt_utf16<char16_t> C;
+        C c;
+        int r = c.encoding();
+        assert(r == 0);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t> C;
+        C c;
+        int r = c.encoding();
+        assert(r == 0);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_in.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_in.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_in.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_in.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,739 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf16
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// result
+//     in(stateT& state,
+//        const externT* from, const externT* from_end, const externT*& from_next,
+//        internT* to, internT* to_end, internT*& to_next) const;
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf16<wchar_t> C;
+        C c;
+        wchar_t w = 0;
+        char n[4] = {char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(w == 0x40003);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x1005);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf16<wchar_t, 0x1000> C;
+        C c;
+        wchar_t w = 0;
+        char n[4] = {char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf16<wchar_t, 0x10ffff, std::consume_header> C;
+        C c;
+        wchar_t w = 0;
+        char n[6] = {char(0xFE), char(0xFF), char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+6, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+6);
+        assert(w == 0x40003);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x1005);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf16<wchar_t, 0x10ffff, std::little_endian> C;
+        C c;
+        wchar_t w = 0;
+        char n[4] = {char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(w == 0x40003);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x1005);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf16<wchar_t, 0x1000, std::little_endian> C;
+        C c;
+        wchar_t w = 0;
+        char n[4] = {char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf16<wchar_t, 0x10ffff, std::codecvt_mode(
+                                                         std::consume_header |
+                                                         std::little_endian)> C;
+        C c;
+        wchar_t w = 0;
+        char n[6] = {char(0xFF), char(0xFE), char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+6, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+6);
+        assert(w == 0x40003);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x1005);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t> C;
+        C c;
+        char32_t w = 0;
+        char n[4] = {char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        char32_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(w == 0x40003);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x1005);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t, 0x1000> C;
+        C c;
+        char32_t w = 0;
+        char n[4] = {char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        char32_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t, 0x10ffff, std::consume_header> C;
+        C c;
+        char32_t w = 0;
+        char n[6] = {char(0xFE), char(0xFF), char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        char32_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+6, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+6);
+        assert(w == 0x40003);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x1005);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t, 0x10ffff, std::little_endian> C;
+        C c;
+        char32_t w = 0;
+        char n[4] = {char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        char32_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(w == 0x40003);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x1005);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t, 0x1000, std::little_endian> C;
+        C c;
+        char32_t w = 0;
+        char n[4] = {char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        char32_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t, 0x10ffff, std::codecvt_mode(
+                                                         std::consume_header |
+                                                         std::little_endian)> C;
+        C c;
+        char32_t w = 0;
+        char n[6] = {char(0xFF), char(0xFE), char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        char32_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+6, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+6);
+        assert(w == 0x40003);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x1005);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+
+    {
+        typedef std::codecvt_utf16<char16_t> C;
+        C c;
+        char16_t w = 0;
+        char n[4] = {char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        char16_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x1005);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf16<char16_t, 0x1000> C;
+        C c;
+        char16_t w = 0;
+        char n[4] = {char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        char16_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf16<char16_t, 0x10ffff, std::consume_header> C;
+        C c;
+        char16_t w = 0;
+        char n[6] = {char(0xFE), char(0xFF), char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        char16_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+6, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n+2);
+        assert(w == 0);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x1005);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf16<char16_t, 0x10ffff, std::little_endian> C;
+        C c;
+        char16_t w = 0;
+        char n[4] = {char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        char16_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x1005);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf16<char16_t, 0x1000, std::little_endian> C;
+        C c;
+        char16_t w = 0;
+        char n[4] = {char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        char16_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf16<char16_t, 0x10ffff, std::codecvt_mode(
+                                                         std::consume_header |
+                                                         std::little_endian)> C;
+        C c;
+        char16_t w = 0;
+        char n[6] = {char(0xFF), char(0xFE), char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        char16_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+6, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n+2);
+        assert(w == 0);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x1005);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x56);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_length.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_length.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_length.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,449 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf16
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// int length(stateT& state, const externT* from, const externT* from_end,
+//            size_t max) const;
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf16<wchar_t> C;
+        C c;
+        char n[4] = {char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 4);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<wchar_t, 0x1000> C;
+        C c;
+        char n[4] = {char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 0);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 0);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<wchar_t, 0x10ffff, std::consume_header> C;
+        C c;
+        char n[6] = {char(0xFE), char(0xFF), char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+6, 2);
+        assert(r == 6);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<wchar_t, 0x10ffff, std::little_endian> C;
+        C c;
+        char n[4] = {char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 4);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<wchar_t, 0x1000, std::little_endian> C;
+        C c;
+        char n[4] = {char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 0);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 0);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<wchar_t, 0x10ffff, std::codecvt_mode(
+                                                         std::consume_header |
+                                                         std::little_endian)> C;
+        C c;
+        char n[6] = {char(0xFF), char(0xFE), char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+6, 2);
+        assert(r == 6);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t> C;
+        C c;
+        char n[4] = {char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 4);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t, 0x1000> C;
+        C c;
+        char n[4] = {char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 0);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 0);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t, 0x10ffff, std::consume_header> C;
+        C c;
+        char n[6] = {char(0xFE), char(0xFF), char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+6, 2);
+        assert(r == 6);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t, 0x10ffff, std::little_endian> C;
+        C c;
+        char n[4] = {char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 4);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t, 0x1000, std::little_endian> C;
+        C c;
+        char n[4] = {char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 0);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 0);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t, 0x10ffff, std::codecvt_mode(
+                                                         std::consume_header |
+                                                         std::little_endian)> C;
+        C c;
+        char n[6] = {char(0xFF), char(0xFE), char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+6, 2);
+        assert(r == 6);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+
+    {
+        typedef std::codecvt_utf16<char16_t> C;
+        C c;
+        char n[4] = {char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 0);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<char16_t, 0x1000> C;
+        C c;
+        char n[4] = {char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 0);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 0);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<char16_t, 0x10ffff, std::consume_header> C;
+        C c;
+        char n[6] = {char(0xFE), char(0xFF), char(0xD8), char(0xC0), char(0xDC), char(0x03)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+6, 2);
+        assert(r == 2);
+
+        n[0] = char(0x10);
+        n[1] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x04);
+        n[1] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x00);
+        n[1] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<char16_t, 0x10ffff, std::little_endian> C;
+        C c;
+        char n[4] = {char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 0);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<char16_t, 0x1000, std::little_endian> C;
+        C c;
+        char n[4] = {char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 0);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 0);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<char16_t, 0x10ffff, std::codecvt_mode(
+                                                         std::consume_header |
+                                                         std::little_endian)> C;
+        C c;
+        char n[6] = {char(0xFF), char(0xFE), char(0xC0), char(0xD8), char(0x03), char(0xDC)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+6, 2);
+        assert(r == 2);
+
+        n[1] = char(0x10);
+        n[0] = char(0x05);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[1] = char(0x04);
+        n[0] = char(0x53);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[1] = char(0x00);
+        n[0] = char(0x56);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_max_length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_max_length.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_max_length.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_max_length.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf16
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// int max_length() const throw();
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf16<wchar_t> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 4);
+    }
+    {
+        typedef std::codecvt_utf16<wchar_t, 0xFFFFFFFF, std::consume_header> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 6);
+    }
+    {
+        typedef std::codecvt_utf16<char16_t> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 2);
+    }
+    {
+        typedef std::codecvt_utf16<char16_t, 0xFFFFFFFF, std::consume_header> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 4);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 4);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t, 0xFFFFFFFF, std::consume_header> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 6);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,331 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf16
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// result
+// out(stateT& state,
+//     const internT* from, const internT* from_end, const internT*& from_next,
+//     externT* to, externT* to_end, externT*& to_next) const;
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf16<wchar_t> C;
+        C c;
+        wchar_t w = 0x40003;
+        char n[4] = {0};
+        const wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(n[0] == char(0xD8));
+        assert(n[1] == char(0xC0));
+        assert(n[2] == char(0xDC));
+        assert(n[3] == char(0x03));
+
+        w = 0x1005;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0x10));
+        assert(n[1] == char(0x05));
+        assert(n[2] == char(0xDC));
+        assert(n[3] == char(0x03));
+
+        w = 0x453;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0x04));
+        assert(n[1] == char(0x53));
+        assert(n[2] == char(0xDC));
+        assert(n[3] == char(0x03));
+
+        w = 0x56;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0x00));
+        assert(n[1] == char(0x56));
+        assert(n[2] == char(0xDC));
+        assert(n[3] == char(0x03));
+    }
+    {
+        typedef std::codecvt_utf16<wchar_t, 0x1000> C;
+        C c;
+        wchar_t w = 0x40003;
+        char n[4] = {0};
+        const wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(n[0] == char(0));
+        assert(n[1] == char(0));
+        assert(n[2] == char(0));
+        assert(n[3] == char(0));
+
+        w = 0x1005;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(n[0] == char(0));
+        assert(n[1] == char(0));
+        assert(n[2] == char(0));
+        assert(n[3] == char(0));
+
+        w = 0x453;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0x04));
+        assert(n[1] == char(0x53));
+        assert(n[2] == char(0));
+        assert(n[3] == char(0));
+
+        w = 0x56;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0x00));
+        assert(n[1] == char(0x56));
+        assert(n[2] == char(0));
+        assert(n[3] == char(0));
+    }
+    {
+        typedef std::codecvt_utf16<wchar_t, 0x10ffff, std::generate_header> C;
+        C c;
+        wchar_t w = 0x40003;
+        char n[6] = {0};
+        const wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+6, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+6);
+        assert(n[0] == char(0xFE));
+        assert(n[1] == char(0xFF));
+        assert(n[2] == char(0xD8));
+        assert(n[3] == char(0xC0));
+        assert(n[4] == char(0xDC));
+        assert(n[5] == char(0x03));
+
+        w = 0x1005;
+        r = c.out(m, &w, &w+1, wp, n, n+6, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(n[0] == char(0xFE));
+        assert(n[1] == char(0xFF));
+        assert(n[2] == char(0x10));
+        assert(n[3] == char(0x05));
+        assert(n[4] == char(0xDC));
+        assert(n[5] == char(0x03));
+
+        w = 0x453;
+        r = c.out(m, &w, &w+1, wp, n, n+6, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(n[0] == char(0xFE));
+        assert(n[1] == char(0xFF));
+        assert(n[2] == char(0x04));
+        assert(n[3] == char(0x53));
+        assert(n[4] == char(0xDC));
+        assert(n[5] == char(0x03));
+
+        w = 0x56;
+        r = c.out(m, &w, &w+1, wp, n, n+6, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(n[0] == char(0xFE));
+        assert(n[1] == char(0xFF));
+        assert(n[2] == char(0x00));
+        assert(n[3] == char(0x56));
+        assert(n[4] == char(0xDC));
+        assert(n[5] == char(0x03));
+    }
+
+    {
+        typedef std::codecvt_utf16<wchar_t, 0x10FFFF, std::little_endian> C;
+        C c;
+        wchar_t w = 0x40003;
+        char n[4] = {0};
+        const wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(n[1] == char(0xD8));
+        assert(n[0] == char(0xC0));
+        assert(n[3] == char(0xDC));
+        assert(n[2] == char(0x03));
+
+        w = 0x1005;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(n[1] == char(0x10));
+        assert(n[0] == char(0x05));
+        assert(n[3] == char(0xDC));
+        assert(n[2] == char(0x03));
+
+        w = 0x453;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(n[1] == char(0x04));
+        assert(n[0] == char(0x53));
+        assert(n[3] == char(0xDC));
+        assert(n[2] == char(0x03));
+
+        w = 0x56;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(n[1] == char(0x00));
+        assert(n[0] == char(0x56));
+        assert(n[3] == char(0xDC));
+        assert(n[2] == char(0x03));
+    }
+    {
+        typedef std::codecvt_utf16<wchar_t, 0x1000, std::little_endian> C;
+        C c;
+        wchar_t w = 0x40003;
+        char n[4] = {0};
+        const wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(n[1] == char(0));
+        assert(n[0] == char(0));
+        assert(n[3] == char(0));
+        assert(n[2] == char(0));
+
+        w = 0x1005;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(n[1] == char(0));
+        assert(n[0] == char(0));
+        assert(n[3] == char(0));
+        assert(n[2] == char(0));
+
+        w = 0x453;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(n[1] == char(0x04));
+        assert(n[0] == char(0x53));
+        assert(n[3] == char(0));
+        assert(n[2] == char(0));
+
+        w = 0x56;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(n[1] == char(0x00));
+        assert(n[0] == char(0x56));
+        assert(n[3] == char(0));
+        assert(n[2] == char(0));
+    }
+    {
+        typedef std::codecvt_utf16<wchar_t, 0x10ffff, std::codecvt_mode(
+                                                         std::generate_header |
+                                                         std::little_endian)> C;
+        C c;
+        wchar_t w = 0x40003;
+        char n[6] = {0};
+        const wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+6, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+6);
+        assert(n[1] == char(0xFE));
+        assert(n[0] == char(0xFF));
+        assert(n[3] == char(0xD8));
+        assert(n[2] == char(0xC0));
+        assert(n[5] == char(0xDC));
+        assert(n[4] == char(0x03));
+
+        w = 0x1005;
+        r = c.out(m, &w, &w+1, wp, n, n+6, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(n[1] == char(0xFE));
+        assert(n[0] == char(0xFF));
+        assert(n[3] == char(0x10));
+        assert(n[2] == char(0x05));
+        assert(n[5] == char(0xDC));
+        assert(n[4] == char(0x03));
+
+        w = 0x453;
+        r = c.out(m, &w, &w+1, wp, n, n+6, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(n[1] == char(0xFE));
+        assert(n[0] == char(0xFF));
+        assert(n[3] == char(0x04));
+        assert(n[2] == char(0x53));
+        assert(n[5] == char(0xDC));
+        assert(n[4] == char(0x03));
+
+        w = 0x56;
+        r = c.out(m, &w, &w+1, wp, n, n+6, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(n[1] == char(0xFE));
+        assert(n[0] == char(0xFF));
+        assert(n[3] == char(0x00));
+        assert(n[2] == char(0x56));
+        assert(n[5] == char(0xDC));
+        assert(n[4] == char(0x03));
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_unshift.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_unshift.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_unshift.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_unshift.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf16
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// result
+//     unshift(stateT& state,
+//             externT* to, externT* to_end, externT*& to_next) const;
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf16<wchar_t> C;
+        C c;
+        char n[4] = {0};
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.unshift(m, n, n+4, np);
+        assert(r == std::codecvt_base::noconv);
+    }
+    {
+        typedef std::codecvt_utf16<char16_t> C;
+        C c;
+        char n[4] = {0};
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.unshift(m, n, n+4, np);
+        assert(r == std::codecvt_base::noconv);
+    }
+    {
+        typedef std::codecvt_utf16<char32_t> C;
+        C c;
+        char n[4] = {0};
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.unshift(m, n, n+4, np);
+        assert(r == std::codecvt_base::noconv);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf8
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// UNSUPPORTED: asan, msan
+
+// Not a portable test
+
+#include <codecvt>
+#include <cstdlib>
+#include <cassert>
+
+int outstanding_news = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++outstanding_news;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    if (p)
+    {
+        --outstanding_news;
+        std::free(p);
+    }
+}
+
+int main()
+{
+    assert(outstanding_news == 0);
+    {
+        typedef std::codecvt_utf8<wchar_t> C;
+        C c;
+        assert(outstanding_news == 0);
+    }
+    {
+        typedef std::codecvt_utf8<wchar_t> C;
+        std::locale loc(std::locale::classic(), new C);
+        assert(outstanding_news != 0);
+    }
+    assert(outstanding_news == 0);
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_always_noconv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_always_noconv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_always_noconv.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_always_noconv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf8
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// bool always_noconv() const throw();
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf8<wchar_t> C;
+        C c;
+        bool r = c.always_noconv();
+        assert(r == false);
+    }
+    {
+        typedef std::codecvt_utf8<char16_t> C;
+        C c;
+        bool r = c.always_noconv();
+        assert(r == false);
+    }
+    {
+        typedef std::codecvt_utf8<char32_t> C;
+        C c;
+        bool r = c.always_noconv();
+        assert(r == false);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_encoding.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_encoding.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_encoding.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_encoding.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf8
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// int encoding() const throw();
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf8<wchar_t> C;
+        C c;
+        int r = c.encoding();
+        assert(r == 0);
+    }
+    {
+        typedef std::codecvt_utf8<char16_t> C;
+        C c;
+        int r = c.encoding();
+        assert(r == 0);
+    }
+    {
+        typedef std::codecvt_utf8<char32_t> C;
+        C c;
+        int r = c.encoding();
+        assert(r == 0);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_in.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_in.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_in.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_in.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,360 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf8
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// result
+//     in(stateT& state,
+//        const externT* from, const externT* from_end, const externT*& from_next,
+//        internT* to, internT* to_end, internT*& to_next) const;
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf8<wchar_t> C;
+        C c;
+        wchar_t w = 0;
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(w == 0x40003);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.in(m, n, n+3, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+3);
+        assert(w == 0x1005);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+1);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf8<wchar_t, 0x1000> C;
+        C c;
+        wchar_t w = 0;
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.in(m, n, n+3, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+1);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf8<wchar_t, 0xFFFFFFFF, std::consume_header> C;
+        C c;
+        wchar_t w = 0;
+        char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)};
+        wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+7, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+7);
+        assert(w == 0x40003);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.in(m, n, n+3, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+3);
+        assert(w == 0x1005);
+
+        n[0] = char(0xEF);
+        n[1] = char(0xBB);
+        n[2] = char(0xBF);
+        n[3] = char(0xD1);
+        n[4] = char(0x93);
+        r = c.in(m, n, n+5, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+5);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+1);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf8<char32_t> C;
+        C c;
+        char32_t w = 0;
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        char32_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(w == 0x40003);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.in(m, n, n+3, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+3);
+        assert(w == 0x1005);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+1);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf8<char32_t, 0x1000> C;
+        C c;
+        char32_t w = 0;
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        char32_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.in(m, n, n+3, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+1);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf8<char32_t, 0xFFFFFFFF, std::consume_header> C;
+        C c;
+        char32_t w = 0;
+        char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)};
+        char32_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+7, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+7);
+        assert(w == 0x40003);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.in(m, n, n+3, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+3);
+        assert(w == 0x1005);
+
+        n[0] = char(0xEF);
+        n[1] = char(0xBB);
+        n[2] = char(0xBF);
+        n[3] = char(0xD1);
+        n[4] = char(0x93);
+        r = c.in(m, n, n+5, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+5);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+1);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf8<char16_t> C;
+        C c;
+        char16_t w = 0;
+        char n[3] = {char(0xE1), char(0x80), char(0x85)};
+        char16_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+3, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+3);
+        assert(w == 0x1005);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+1);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf8<char16_t, 0x1000> C;
+        C c;
+        char16_t w = 0;
+        char n[3] = {char(0xE1), char(0x80), char(0x85)};
+        char16_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+3, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(w == 0);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+1);
+        assert(w == 0x56);
+    }
+    {
+        typedef std::codecvt_utf8<char16_t, 0xFFFFFFFF, std::consume_header> C;
+        C c;
+        char16_t w = 0;
+        char n[6] = {char(0xEF), char(0xBB), char(0xBF), char(0xE1), char(0x80), char(0x85)};
+        char16_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+6, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+6);
+        assert(w == 0x1005);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.in(m, n, n+2, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(w == 0x453);
+
+        w = 0x56;
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, &w, &w+1, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+1);
+        assert(w == 0x56);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_length.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_length.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_length.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,244 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf8
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// int length(stateT& state, const externT* from, const externT* from_end,
+//            size_t max) const;
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf8<wchar_t> C;
+        C c;
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 1);
+        assert(r == 4);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 3);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.length(m, n, n+2, 3);
+        assert(r == 2);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 3);
+        assert(r == 1);
+    }
+    {
+        typedef std::codecvt_utf8<wchar_t, 0x1000> C;
+        C c;
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 1);
+        assert(r == 0);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 0);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.length(m, n, n+2, 3);
+        assert(r == 2);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 3);
+        assert(r == 1);
+    }
+    {
+        typedef std::codecvt_utf8<wchar_t, 0xFFFFFFFF, std::consume_header> C;
+        C c;
+        char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+7, 1);
+        assert(r == 7);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 3);
+
+        n[0] = char(0xEF);
+        n[1] = char(0xBB);
+        n[2] = char(0xBF);
+        n[3] = char(0xD1);
+        n[4] = char(0x93);
+        r = c.length(m, n, n+5, 3);
+        assert(r == 5);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 3);
+        assert(r == 1);
+    }
+    {
+        typedef std::codecvt_utf8<char32_t> C;
+        C c;
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 1);
+        assert(r == 4);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 3);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.length(m, n, n+2, 3);
+        assert(r == 2);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 3);
+        assert(r == 1);
+    }
+    {
+        typedef std::codecvt_utf8<char32_t, 0x1000> C;
+        C c;
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 1);
+        assert(r == 0);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 0);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.length(m, n, n+2, 3);
+        assert(r == 2);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 3);
+        assert(r == 1);
+    }
+    {
+        typedef std::codecvt_utf8<char32_t, 0xFFFFFFFF, std::consume_header> C;
+        C c;
+        char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+7, 1);
+        assert(r == 7);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 3);
+
+        n[0] = char(0xEF);
+        n[1] = char(0xBB);
+        n[2] = char(0xBF);
+        n[3] = char(0xD1);
+        n[4] = char(0x93);
+        r = c.length(m, n, n+5, 3);
+        assert(r == 5);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 3);
+        assert(r == 1);
+    }
+    {
+        typedef std::codecvt_utf8<char16_t> C;
+        C c;
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 1);
+        assert(r == 0);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 3);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.length(m, n, n+2, 3);
+        assert(r == 2);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 3);
+        assert(r == 1);
+    }
+    {
+        typedef std::codecvt_utf8<char16_t, 0x1000> C;
+        C c;
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 1);
+        assert(r == 0);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 0);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.length(m, n, n+2, 3);
+        assert(r == 2);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 3);
+        assert(r == 1);
+    }
+    {
+        typedef std::codecvt_utf8<char16_t, 0xFFFFFFFF, std::consume_header> C;
+        C c;
+        char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+7, 1);
+        assert(r == 3);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 3);
+
+        n[0] = char(0xEF);
+        n[1] = char(0xBB);
+        n[2] = char(0xBF);
+        n[3] = char(0xD1);
+        n[4] = char(0x93);
+        r = c.length(m, n, n+5, 3);
+        assert(r == 5);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 3);
+        assert(r == 1);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_max_length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_max_length.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_max_length.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_max_length.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf8
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// int max_length() const throw();
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf8<wchar_t> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 4);
+    }
+    {
+        typedef std::codecvt_utf8<wchar_t, 0xFFFFFFFF, std::consume_header> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 7);
+    }
+    {
+        typedef std::codecvt_utf8<char16_t> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 3);
+    }
+    {
+        typedef std::codecvt_utf8<char16_t, 0xFFFFFFFF, std::consume_header> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 6);
+    }
+    {
+        typedef std::codecvt_utf8<char32_t> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 4);
+    }
+    {
+        typedef std::codecvt_utf8<char32_t, 0xFFFFFFFF, std::consume_header> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 7);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,456 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf8
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// result
+// out(stateT& state,
+//     const internT* from, const internT* from_end, const internT*& from_next,
+//     externT* to, externT* to_end, externT*& to_next) const;
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf8<wchar_t> C;
+        C c;
+        wchar_t w = 0x40003;
+        char n[4] = {0};
+        const wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(n[0] == char(0xF1));
+        assert(n[1] == char(0x80));
+        assert(n[2] == char(0x80));
+        assert(n[3] == char(0x83));
+
+        w = 0x1005;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+3);
+        assert(n[0] == char(0xE1));
+        assert(n[1] == char(0x80));
+        assert(n[2] == char(0x85));
+        assert(n[3] == char(0x83));
+
+        w = 0x453;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0xD1));
+        assert(n[1] == char(0x93));
+        assert(n[2] == char(0x85));
+        assert(n[3] == char(0x83));
+
+        w = 0x56;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+1);
+        assert(n[0] == char(0x56));
+        assert(n[1] == char(0x93));
+        assert(n[2] == char(0x85));
+        assert(n[3] == char(0x83));
+    }
+    {
+        typedef std::codecvt_utf8<wchar_t, 0x1000> C;
+        C c;
+        wchar_t w = 0x40003;
+        char n[4] = {0};
+        const wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(n[0] == char(0));
+        assert(n[1] == char(0));
+        assert(n[2] == char(0));
+        assert(n[3] == char(0));
+
+        w = 0x1005;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(n[0] == char(0));
+        assert(n[1] == char(0));
+        assert(n[2] == char(0));
+        assert(n[3] == char(0));
+
+        w = 0x453;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0xD1));
+        assert(n[1] == char(0x93));
+        assert(n[2] == char(0));
+        assert(n[3] == char(0));
+
+        w = 0x56;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+1);
+        assert(n[0] == char(0x56));
+        assert(n[1] == char(0x93));
+        assert(n[2] == char(0));
+        assert(n[3] == char(0));
+    }
+    {
+        typedef std::codecvt_utf8<wchar_t, 0xFFFFFFFF, std::generate_header> C;
+        C c;
+        wchar_t w = 0x40003;
+        char n[7] = {0};
+        const wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+7);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xF1));
+        assert(n[4] == char(0x80));
+        assert(n[5] == char(0x80));
+        assert(n[6] == char(0x83));
+
+        w = 0x1005;
+        r = c.out(m, &w, &w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+6);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xE1));
+        assert(n[4] == char(0x80));
+        assert(n[5] == char(0x85));
+        assert(n[6] == char(0x83));
+
+        w = 0x453;
+        r = c.out(m, &w, &w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+5);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xD1));
+        assert(n[4] == char(0x93));
+        assert(n[5] == char(0x85));
+        assert(n[6] == char(0x83));
+
+        w = 0x56;
+        r = c.out(m, &w, &w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0x56));
+        assert(n[4] == char(0x93));
+        assert(n[5] == char(0x85));
+        assert(n[6] == char(0x83));
+    }
+    {
+        typedef std::codecvt_utf8<char32_t> C;
+        C c;
+        char32_t w = 0x40003;
+        char n[4] = {0};
+        const char32_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(n[0] == char(0xF1));
+        assert(n[1] == char(0x80));
+        assert(n[2] == char(0x80));
+        assert(n[3] == char(0x83));
+
+        w = 0x1005;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+3);
+        assert(n[0] == char(0xE1));
+        assert(n[1] == char(0x80));
+        assert(n[2] == char(0x85));
+        assert(n[3] == char(0x83));
+
+        w = 0x453;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0xD1));
+        assert(n[1] == char(0x93));
+        assert(n[2] == char(0x85));
+        assert(n[3] == char(0x83));
+
+        w = 0x56;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+1);
+        assert(n[0] == char(0x56));
+        assert(n[1] == char(0x93));
+        assert(n[2] == char(0x85));
+        assert(n[3] == char(0x83));
+    }
+    {
+        typedef std::codecvt_utf8<char32_t, 0x1000> C;
+        C c;
+        char32_t w = 0x40003;
+        char n[4] = {0};
+        const char32_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(n[0] == char(0));
+        assert(n[1] == char(0));
+        assert(n[2] == char(0));
+        assert(n[3] == char(0));
+
+        w = 0x1005;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(n[0] == char(0));
+        assert(n[1] == char(0));
+        assert(n[2] == char(0));
+        assert(n[3] == char(0));
+
+        w = 0x453;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0xD1));
+        assert(n[1] == char(0x93));
+        assert(n[2] == char(0));
+        assert(n[3] == char(0));
+
+        w = 0x56;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+1);
+        assert(n[0] == char(0x56));
+        assert(n[1] == char(0x93));
+        assert(n[2] == char(0));
+        assert(n[3] == char(0));
+    }
+    {
+        typedef std::codecvt_utf8<char32_t, 0xFFFFFFFF, std::generate_header> C;
+        C c;
+        char32_t w = 0x40003;
+        char n[7] = {0};
+        const char32_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+7);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xF1));
+        assert(n[4] == char(0x80));
+        assert(n[5] == char(0x80));
+        assert(n[6] == char(0x83));
+
+        w = 0x1005;
+        r = c.out(m, &w, &w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+6);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xE1));
+        assert(n[4] == char(0x80));
+        assert(n[5] == char(0x85));
+        assert(n[6] == char(0x83));
+
+        w = 0x453;
+        r = c.out(m, &w, &w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+5);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xD1));
+        assert(n[4] == char(0x93));
+        assert(n[5] == char(0x85));
+        assert(n[6] == char(0x83));
+
+        w = 0x56;
+        r = c.out(m, &w, &w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0x56));
+        assert(n[4] == char(0x93));
+        assert(n[5] == char(0x85));
+        assert(n[6] == char(0x83));
+    }
+    {
+        typedef std::codecvt_utf8<char16_t> C;
+        C c;
+        char16_t w = 0x1005;
+        char n[4] = {0};
+        const char16_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+3);
+        assert(n[0] == char(0xE1));
+        assert(n[1] == char(0x80));
+        assert(n[2] == char(0x85));
+        assert(n[3] == char(0));
+
+        w = 0x453;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0xD1));
+        assert(n[1] == char(0x93));
+        assert(n[2] == char(0x85));
+        assert(n[3] == char(0));
+
+        w = 0x56;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+1);
+        assert(n[0] == char(0x56));
+        assert(n[1] == char(0x93));
+        assert(n[2] == char(0x85));
+        assert(n[3] == char(0));
+    }
+    {
+        typedef std::codecvt_utf8<char16_t, 0x1000> C;
+        C c;
+        char16_t w = 0x1005;
+        char n[4] = {0};
+        const char16_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::error);
+        assert(wp == &w);
+        assert(np == n);
+        assert(n[0] == char(0));
+        assert(n[1] == char(0));
+        assert(n[2] == char(0));
+        assert(n[3] == char(0));
+
+        w = 0x453;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0xD1));
+        assert(n[1] == char(0x93));
+        assert(n[2] == char(0));
+        assert(n[3] == char(0));
+
+        w = 0x56;
+        r = c.out(m, &w, &w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+1);
+        assert(n[0] == char(0x56));
+        assert(n[1] == char(0x93));
+        assert(n[2] == char(0));
+        assert(n[3] == char(0));
+    }
+    {
+        typedef std::codecvt_utf8<char16_t, 0xFFFFFFFF, std::generate_header> C;
+        C c;
+        char16_t w = 0x1005;
+        char n[7] = {0};
+        const char16_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+6);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xE1));
+        assert(n[4] == char(0x80));
+        assert(n[5] == char(0x85));
+        assert(n[6] == char(0));
+
+        w = 0x453;
+        r = c.out(m, &w, &w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+5);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xD1));
+        assert(n[4] == char(0x93));
+        assert(n[5] == char(0x85));
+        assert(n[6] == char(0));
+
+        w = 0x56;
+        r = c.out(m, &w, &w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == &w+1);
+        assert(np == n+4);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0x56));
+        assert(n[4] == char(0x93));
+        assert(n[5] == char(0x85));
+        assert(n[6] == char(0));
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_unshift.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_unshift.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_unshift.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_unshift.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf8
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// result
+//     unshift(stateT& state,
+//             externT* to, externT* to_end, externT*& to_next) const;
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf8<wchar_t> C;
+        C c;
+        char n[4] = {0};
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.unshift(m, n, n+4, np);
+        assert(r == std::codecvt_base::noconv);
+    }
+    {
+        typedef std::codecvt_utf8<char16_t> C;
+        C c;
+        char n[4] = {0};
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.unshift(m, n, n+4, np);
+        assert(r == std::codecvt_base::noconv);
+    }
+    {
+        typedef std::codecvt_utf8<char32_t> C;
+        C c;
+        char n[4] = {0};
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.unshift(m, n, n+4, np);
+        assert(r == std::codecvt_base::noconv);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_always_noconv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_always_noconv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_always_noconv.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_always_noconv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf8_utf16
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// bool always_noconv() const throw();
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf8_utf16<wchar_t> C;
+        C c;
+        bool r = c.always_noconv();
+        assert(r == false);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char16_t> C;
+        C c;
+        bool r = c.always_noconv();
+        assert(r == false);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char32_t> C;
+        C c;
+        bool r = c.always_noconv();
+        assert(r == false);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_encoding.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_encoding.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_encoding.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_encoding.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf8_utf16
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// int encoding() const throw();
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf8_utf16<wchar_t> C;
+        C c;
+        int r = c.encoding();
+        assert(r == 0);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char16_t> C;
+        C c;
+        int r = c.encoding();
+        assert(r == 0);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char32_t> C;
+        C c;
+        int r = c.encoding();
+        assert(r == 0);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,372 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf8_utf16
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// result
+//     in(stateT& state,
+//        const externT* from, const externT* from_end, const externT*& from_next,
+//        internT* to, internT* to_end, internT*& to_next) const;
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf8_utf16<wchar_t> C;
+        C c;
+        wchar_t w[2] = {0};
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+2);
+        assert(np == n+4);
+        assert(w[0] == 0xD8C0);
+        assert(w[1] == 0xDC03);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.in(m, n, n+3, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+3);
+        assert(w[0] == 0x1005);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.in(m, n, n+2, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+2);
+        assert(w[0] == 0x0453);
+
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+1);
+        assert(w[0] == 0x0056);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<wchar_t, 0x1000> C;
+        C c;
+        wchar_t w[2] = {0};
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == w);
+        assert(np == n);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.in(m, n, n+3, np, w, w+2, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == w);
+        assert(np == n);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.in(m, n, n+2, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+2);
+        assert(w[0] == 0x0453);
+
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+1);
+        assert(w[0] == 0x0056);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<wchar_t, 0x10ffff, std::consume_header> C;
+        C c;
+        wchar_t w[2] = {0};
+        char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)};
+        wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+7, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+2);
+        assert(np == n+7);
+        assert(w[0] == 0xD8C0);
+        assert(w[1] == 0xDC03);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.in(m, n, n+3, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+3);
+        assert(w[0] == 0x1005);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.in(m, n, n+2, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+2);
+        assert(w[0] == 0x0453);
+
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+1);
+        assert(w[0] == 0x0056);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char32_t> C;
+        C c;
+        char32_t w[2] = {0};
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        char32_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+2);
+        assert(np == n+4);
+        assert(w[0] == 0xD8C0);
+        assert(w[1] == 0xDC03);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.in(m, n, n+3, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+3);
+        assert(w[0] == 0x1005);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.in(m, n, n+2, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+2);
+        assert(w[0] == 0x0453);
+
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+1);
+        assert(w[0] == 0x0056);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char32_t, 0x1000> C;
+        C c;
+        char32_t w[2] = {0};
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        char32_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == w);
+        assert(np == n);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.in(m, n, n+3, np, w, w+2, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == w);
+        assert(np == n);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.in(m, n, n+2, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+2);
+        assert(w[0] == 0x0453);
+
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+1);
+        assert(w[0] == 0x0056);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char32_t, 0x10ffff, std::consume_header> C;
+        C c;
+        char32_t w[2] = {0};
+        char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)};
+        char32_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+7, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+2);
+        assert(np == n+7);
+        assert(w[0] == 0xD8C0);
+        assert(w[1] == 0xDC03);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.in(m, n, n+3, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+3);
+        assert(w[0] == 0x1005);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.in(m, n, n+2, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+2);
+        assert(w[0] == 0x0453);
+
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+1);
+        assert(w[0] == 0x0056);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char16_t> C;
+        C c;
+        char16_t w[2] = {0};
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        char16_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+2);
+        assert(np == n+4);
+        assert(w[0] == 0xD8C0);
+        assert(w[1] == 0xDC03);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.in(m, n, n+3, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+3);
+        assert(w[0] == 0x1005);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.in(m, n, n+2, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+2);
+        assert(w[0] == 0x0453);
+
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+1);
+        assert(w[0] == 0x0056);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char16_t, 0x1000> C;
+        C c;
+        char16_t w[2] = {0};
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        char16_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == w);
+        assert(np == n);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.in(m, n, n+3, np, w, w+2, wp);
+        assert(r == std::codecvt_base::error);
+        assert(wp == w);
+        assert(np == n);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.in(m, n, n+2, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+2);
+        assert(w[0] == 0x0453);
+
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+1);
+        assert(w[0] == 0x0056);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char16_t, 0x10ffff, std::consume_header> C;
+        C c;
+        char16_t w[2] = {0};
+        char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)};
+        char16_t* wp = nullptr;
+        std::mbstate_t m;
+        const char* np = nullptr;
+        std::codecvt_base::result r = c.in(m, n, n+7, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+2);
+        assert(np == n+7);
+        assert(w[0] == 0xD8C0);
+        assert(w[1] == 0xDC03);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.in(m, n, n+3, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+3);
+        assert(w[0] == 0x1005);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.in(m, n, n+2, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+2);
+        assert(w[0] == 0x0453);
+
+        n[0] = char(0x56);
+        r = c.in(m, n, n+1, np, w, w+2, wp);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+1);
+        assert(w[0] == 0x0056);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_length.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_length.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_length.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,235 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf8_utf16
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// int length(stateT& state, const externT* from, const externT* from_end,
+//            size_t max) const;
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf8_utf16<wchar_t> C;
+        C c;
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 4);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 3);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 2);
+        assert(r == 1);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<wchar_t, 0x1000> C;
+        C c;
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 0);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 0);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 2);
+        assert(r == 1);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<wchar_t, 0x10ffff, std::consume_header> C;
+        C c;
+        char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+7, 2);
+        assert(r == 7);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 3);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 2);
+        assert(r == 1);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char32_t> C;
+        C c;
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 4);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 3);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 2);
+        assert(r == 1);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char32_t, 0x1000> C;
+        C c;
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 0);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 0);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 2);
+        assert(r == 1);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char32_t, 0x10ffff, std::consume_header> C;
+        C c;
+        char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+7, 2);
+        assert(r == 7);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 3);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 2);
+        assert(r == 1);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char16_t> C;
+        C c;
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 4);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 3);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 2);
+        assert(r == 1);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char16_t, 0x1000> C;
+        C c;
+        char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+4, 2);
+        assert(r == 0);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 0);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 2);
+        assert(r == 1);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char16_t, 0x10ffff, std::consume_header> C;
+        C c;
+        char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)};
+        std::mbstate_t m;
+        int r = c.length(m, n, n+7, 2);
+        assert(r == 7);
+
+        n[0] = char(0xE1);
+        n[1] = char(0x80);
+        n[2] = char(0x85);
+        r = c.length(m, n, n+3, 2);
+        assert(r == 3);
+
+        n[0] = char(0xD1);
+        n[1] = char(0x93);
+        r = c.length(m, n, n+2, 2);
+        assert(r == 2);
+
+        n[0] = char(0x56);
+        r = c.length(m, n, n+1, 2);
+        assert(r == 1);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_max_length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_max_length.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_max_length.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_max_length.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf8_utf16
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// int max_length() const throw();
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf8_utf16<wchar_t> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 4);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<wchar_t, 0xFFFFFFFF, std::consume_header> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 7);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char16_t> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 4);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char16_t, 0xFFFFFFFF, std::consume_header> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 7);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char32_t> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 4);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char32_t, 0xFFFFFFFF, std::consume_header> C;
+        C c;
+        int r = c.max_length();
+        assert(r == 7);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,415 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf8_utf16
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// result
+// out(stateT& state,
+//     const internT* from, const internT* from_end, const internT*& from_next,
+//     externT* to, externT* to_end, externT*& to_next) const;
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf8_utf16<wchar_t> C;
+        C c;
+        wchar_t w[2] = {0xD8C0, 0xDC03};
+        char n[4] = {0};
+        const wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+2);
+        assert(np == n+4);
+        assert(n[0] == char(0xF1));
+        assert(n[1] == char(0x80));
+        assert(n[2] == char(0x80));
+        assert(n[3] == char(0x83));
+
+        w[0] = 0x1005;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+3);
+        assert(n[0] == char(0xE1));
+        assert(n[1] == char(0x80));
+        assert(n[2] == char(0x85));
+
+        w[0] = 0x453;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0xD1));
+        assert(n[1] == char(0x93));
+
+        w[0] = 0x56;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+1);
+        assert(n[0] == char(0x56));
+    }
+    {
+        typedef std::codecvt_utf8_utf16<wchar_t, 0x1000> C;
+        C c;
+        wchar_t w[2] = {0xD8C0, 0xDC03};
+        char n[4] = {0};
+        const wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np);
+        assert(r == std::codecvt_base::error);
+        assert(wp == w);
+        assert(np == n);
+
+        w[0] = 0x1005;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::error);
+        assert(wp == w);
+        assert(np == n);
+
+        w[0] = 0x453;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0xD1));
+        assert(n[1] == char(0x93));
+
+        w[0] = 0x56;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+1);
+        assert(n[0] == char(0x56));
+    }
+    {
+        typedef std::codecvt_utf8_utf16<wchar_t, 0x10ffff, std::generate_header> C;
+        C c;
+        wchar_t w[2] = {0xD8C0, 0xDC03};
+        char n[7] = {0};
+        const wchar_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+2);
+        assert(np == n+7);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xF1));
+        assert(n[4] == char(0x80));
+        assert(n[5] == char(0x80));
+        assert(n[6] == char(0x83));
+
+        w[0] = 0x1005;
+        r = c.out(m, w, w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+6);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xE1));
+        assert(n[4] == char(0x80));
+        assert(n[5] == char(0x85));
+
+        w[0] = 0x453;
+        r = c.out(m, w, w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+5);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xD1));
+        assert(n[4] == char(0x93));
+
+        w[0] = 0x56;
+        r = c.out(m, w, w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+4);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0x56));
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char32_t> C;
+        C c;
+        char32_t w[2] = {0xD8C0, 0xDC03};
+        char n[4] = {0};
+        const char32_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+2);
+        assert(np == n+4);
+        assert(n[0] == char(0xF1));
+        assert(n[1] == char(0x80));
+        assert(n[2] == char(0x80));
+        assert(n[3] == char(0x83));
+
+        w[0] = 0x1005;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+3);
+        assert(n[0] == char(0xE1));
+        assert(n[1] == char(0x80));
+        assert(n[2] == char(0x85));
+
+        w[0] = 0x453;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0xD1));
+        assert(n[1] == char(0x93));
+
+        w[0] = 0x56;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+1);
+        assert(n[0] == char(0x56));
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char32_t, 0x1000> C;
+        C c;
+        char32_t w[2] = {0xD8C0, 0xDC03};
+        char n[4] = {0};
+        const char32_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np);
+        assert(r == std::codecvt_base::error);
+        assert(wp == w);
+        assert(np == n);
+
+        w[0] = 0x1005;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::error);
+        assert(wp == w);
+        assert(np == n);
+
+        w[0] = 0x453;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0xD1));
+        assert(n[1] == char(0x93));
+
+        w[0] = 0x56;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+1);
+        assert(n[0] == char(0x56));
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char32_t, 0x10ffff, std::generate_header> C;
+        C c;
+        char32_t w[2] = {0xD8C0, 0xDC03};
+        char n[7] = {0};
+        const char32_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+2);
+        assert(np == n+7);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xF1));
+        assert(n[4] == char(0x80));
+        assert(n[5] == char(0x80));
+        assert(n[6] == char(0x83));
+
+        w[0] = 0x1005;
+        r = c.out(m, w, w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+6);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xE1));
+        assert(n[4] == char(0x80));
+        assert(n[5] == char(0x85));
+
+        w[0] = 0x453;
+        r = c.out(m, w, w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+5);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xD1));
+        assert(n[4] == char(0x93));
+
+        w[0] = 0x56;
+        r = c.out(m, w, w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+4);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0x56));
+    }
+
+    {
+        typedef std::codecvt_utf8_utf16<char16_t> C;
+        C c;
+        char16_t w[2] = {0xD8C0, 0xDC03};
+        char n[4] = {0};
+        const char16_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+2);
+        assert(np == n+4);
+        assert(n[0] == char(0xF1));
+        assert(n[1] == char(0x80));
+        assert(n[2] == char(0x80));
+        assert(n[3] == char(0x83));
+
+        w[0] = 0x1005;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+3);
+        assert(n[0] == char(0xE1));
+        assert(n[1] == char(0x80));
+        assert(n[2] == char(0x85));
+
+        w[0] = 0x453;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0xD1));
+        assert(n[1] == char(0x93));
+
+        w[0] = 0x56;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+1);
+        assert(n[0] == char(0x56));
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char16_t, 0x1000> C;
+        C c;
+        char16_t w[2] = {0xD8C0, 0xDC03};
+        char n[4] = {0};
+        const char16_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np);
+        assert(r == std::codecvt_base::error);
+        assert(wp == w);
+        assert(np == n);
+
+        w[0] = 0x1005;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::error);
+        assert(wp == w);
+        assert(np == n);
+
+        w[0] = 0x453;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+2);
+        assert(n[0] == char(0xD1));
+        assert(n[1] == char(0x93));
+
+        w[0] = 0x56;
+        r = c.out(m, w, w+1, wp, n, n+4, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+1);
+        assert(n[0] == char(0x56));
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char16_t, 0x10ffff, std::generate_header> C;
+        C c;
+        char16_t w[2] = {0xD8C0, 0xDC03};
+        char n[7] = {0};
+        const char16_t* wp = nullptr;
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+2);
+        assert(np == n+7);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xF1));
+        assert(n[4] == char(0x80));
+        assert(n[5] == char(0x80));
+        assert(n[6] == char(0x83));
+
+        w[0] = 0x1005;
+        r = c.out(m, w, w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+6);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xE1));
+        assert(n[4] == char(0x80));
+        assert(n[5] == char(0x85));
+
+        w[0] = 0x453;
+        r = c.out(m, w, w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+5);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0xD1));
+        assert(n[4] == char(0x93));
+
+        w[0] = 0x56;
+        r = c.out(m, w, w+1, wp, n, n+7, np);
+        assert(r == std::codecvt_base::ok);
+        assert(wp == w+1);
+        assert(np == n+4);
+        assert(n[0] == char(0xEF));
+        assert(n[1] == char(0xBB));
+        assert(n[2] == char(0xBF));
+        assert(n[3] == char(0x56));
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_unshift.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_unshift.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_unshift.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_unshift.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+// template <class Elem, unsigned long Maxcode = 0x10ffff,
+//           codecvt_mode Mode = (codecvt_mode)0>
+// class codecvt_utf8_utf16
+//     : public codecvt<Elem, char, mbstate_t>
+// {
+//     // unspecified
+// };
+
+// result
+//     unshift(stateT& state,
+//             externT* to, externT* to_end, externT*& to_next) const;
+
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf8_utf16<wchar_t> C;
+        C c;
+        char n[4] = {0};
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.unshift(m, n, n+4, np);
+        assert(r == std::codecvt_base::noconv);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char16_t> C;
+        C c;
+        char n[4] = {0};
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.unshift(m, n, n+4, np);
+        assert(r == std::codecvt_base::noconv);
+    }
+    {
+        typedef std::codecvt_utf8_utf16<char32_t> C;
+        C c;
+        char n[4] = {0};
+        std::mbstate_t m;
+        char* np = nullptr;
+        std::codecvt_base::result r = c.unshift(m, n, n+4, np);
+        assert(r == std::codecvt_base::noconv);
+    }
+}

Added: libcxx/trunk/test/std/localization/locale.stdcvt/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.stdcvt/version.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <codecvt>
+
+#include <codecvt>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locale.syn/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.syn/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locale.syn/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locale.syn/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isalnum.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isalnum.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isalnum.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isalnum.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> bool isalnum (charT c, const locale& loc);
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l;
+    assert(!std::isalnum(' ', l));
+    assert(!std::isalnum('<', l));
+    assert(!std::isalnum('\x8', l));
+    assert( std::isalnum('A', l));
+    assert( std::isalnum('a', l));
+    assert( std::isalnum('z', l));
+    assert( std::isalnum('3', l));
+    assert(!std::isalnum('.', l));
+    assert( std::isalnum('f', l));
+    assert( std::isalnum('9', l));
+    assert(!std::isalnum('+', l));
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isalpha.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isalpha.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isalpha.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isalpha.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> bool isalpha (charT c, const locale& loc);
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l;
+    assert(!std::isalpha(' ', l));
+    assert(!std::isalpha('<', l));
+    assert(!std::isalpha('\x8', l));
+    assert( std::isalpha('A', l));
+    assert( std::isalpha('a', l));
+    assert( std::isalpha('z', l));
+    assert(!std::isalpha('3', l));
+    assert(!std::isalpha('.', l));
+    assert( std::isalpha('f', l));
+    assert(!std::isalpha('9', l));
+    assert(!std::isalpha('+', l));
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/classification/iscntrl.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/classification/iscntrl.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/classification/iscntrl.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/classification/iscntrl.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> bool iscntrl (charT c, const locale& loc);
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l;
+    assert(!std::iscntrl(' ', l));
+    assert(!std::iscntrl('<', l));
+    assert( std::iscntrl('\x8', l));
+    assert(!std::iscntrl('A', l));
+    assert(!std::iscntrl('a', l));
+    assert(!std::iscntrl('z', l));
+    assert(!std::iscntrl('3', l));
+    assert(!std::iscntrl('.', l));
+    assert(!std::iscntrl('f', l));
+    assert(!std::iscntrl('9', l));
+    assert(!std::iscntrl('+', l));
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isdigit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isdigit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isdigit.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isdigit.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> bool isdigit (charT c, const locale& loc);
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l;
+    assert(!std::isdigit(' ', l));
+    assert(!std::isdigit('<', l));
+    assert(!std::isdigit('\x8', l));
+    assert(!std::isdigit('A', l));
+    assert(!std::isdigit('a', l));
+    assert(!std::isdigit('z', l));
+    assert( std::isdigit('3', l));
+    assert(!std::isdigit('.', l));
+    assert(!std::isdigit('f', l));
+    assert( std::isdigit('9', l));
+    assert(!std::isdigit('+', l));
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isgraph.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isgraph.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isgraph.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isgraph.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> bool isgraph (charT c, const locale& loc);
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l;
+    assert(!std::isgraph(' ', l));
+    assert( std::isgraph('<', l));
+    assert(!std::isgraph('\x8', l));
+    assert( std::isgraph('A', l));
+    assert( std::isgraph('a', l));
+    assert( std::isgraph('z', l));
+    assert( std::isgraph('3', l));
+    assert( std::isgraph('.', l));
+    assert( std::isgraph('f', l));
+    assert( std::isgraph('9', l));
+    assert( std::isgraph('+', l));
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/classification/islower.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/classification/islower.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/classification/islower.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/classification/islower.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> bool islower (charT c, const locale& loc);
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l;
+    assert(!std::islower(' ', l));
+    assert(!std::islower('<', l));
+    assert(!std::islower('\x8', l));
+    assert(!std::islower('A', l));
+    assert( std::islower('a', l));
+    assert( std::islower('z', l));
+    assert(!std::islower('3', l));
+    assert(!std::islower('.', l));
+    assert( std::islower('f', l));
+    assert(!std::islower('9', l));
+    assert(!std::islower('+', l));
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isprint.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isprint.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isprint.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isprint.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> bool isprint (charT c, const locale& loc);
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l;
+    assert( std::isprint(' ', l));
+    assert( std::isprint('<', l));
+    assert(!std::isprint('\x8', l));
+    assert( std::isprint('A', l));
+    assert( std::isprint('a', l));
+    assert( std::isprint('z', l));
+    assert( std::isprint('3', l));
+    assert( std::isprint('.', l));
+    assert( std::isprint('f', l));
+    assert( std::isprint('9', l));
+    assert( std::isprint('+', l));
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/classification/ispunct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/classification/ispunct.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/classification/ispunct.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/classification/ispunct.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> bool ispunct (charT c, const locale& loc);
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l;
+    assert(!std::ispunct(' ', l));
+    assert( std::ispunct('<', l));
+    assert(!std::ispunct('\x8', l));
+    assert(!std::ispunct('A', l));
+    assert(!std::ispunct('a', l));
+    assert(!std::ispunct('z', l));
+    assert(!std::ispunct('3', l));
+    assert( std::ispunct('.', l));
+    assert(!std::ispunct('f', l));
+    assert(!std::ispunct('9', l));
+    assert( std::ispunct('+', l));
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isspace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isspace.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isspace.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isspace.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> bool isspace (charT c, const locale& loc);
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l;
+    assert( std::isspace(' ', l));
+    assert(!std::isspace('<', l));
+    assert(!std::isspace('\x8', l));
+    assert(!std::isspace('A', l));
+    assert(!std::isspace('a', l));
+    assert(!std::isspace('z', l));
+    assert(!std::isspace('3', l));
+    assert(!std::isspace('.', l));
+    assert(!std::isspace('f', l));
+    assert(!std::isspace('9', l));
+    assert(!std::isspace('+', l));
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isupper.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isupper.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isupper.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isupper.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> bool isupper (charT c, const locale& loc);
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l;
+    assert(!std::isupper(' ', l));
+    assert(!std::isupper('<', l));
+    assert(!std::isupper('\x8', l));
+    assert( std::isupper('A', l));
+    assert(!std::isupper('a', l));
+    assert(!std::isupper('z', l));
+    assert(!std::isupper('3', l));
+    assert(!std::isupper('.', l));
+    assert(!std::isupper('f', l));
+    assert(!std::isupper('9', l));
+    assert(!std::isupper('+', l));
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isxdigit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isxdigit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isxdigit.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/classification/isxdigit.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> bool isxdigit (charT c, const locale& loc);
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l;
+    assert(!std::isxdigit(' ', l));
+    assert(!std::isxdigit('<', l));
+    assert(!std::isxdigit('\x8', l));
+    assert( std::isxdigit('A', l));
+    assert( std::isxdigit('a', l));
+    assert(!std::isxdigit('z', l));
+    assert( std::isxdigit('3', l));
+    assert(!std::isxdigit('.', l));
+    assert( std::isxdigit('f', l));
+    assert( std::isxdigit('9', l));
+    assert(!std::isxdigit('+', l));
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// wbuffer_convert<Codecvt, Elem, Tr>
+
+// wbuffer_convert(streambuf *bytebuf = 0, Codecvt *pcvt = new Codecvt,
+//                 state_type state = state_type());
+
+// UNSUPPORTED: asan, msan
+
+#include <locale>
+#include <codecvt>
+#include <sstream>
+#include <cassert>
+#include <new>
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+int main()
+{
+    typedef std::wbuffer_convert<std::codecvt_utf8<wchar_t> > B;
+#if _LIBCPP_STD_VER > 11
+    static_assert(!std::is_convertible<std::streambuf*, B>::value, "");
+    static_assert( std::is_constructible<B, std::streambuf*>::value, "");
+#endif
+    {
+        B b;
+        assert(b.rdbuf() == nullptr);
+        assert(new_called != 0);
+    }
+    assert(new_called == 0);
+    {
+        std::stringstream s;
+        B b(s.rdbuf());
+        assert(b.rdbuf() == s.rdbuf());
+        assert(new_called != 0);
+    }
+    assert(new_called == 0);
+    {
+        std::stringstream s;
+        B b(s.rdbuf(), new std::codecvt_utf8<wchar_t>);
+        assert(b.rdbuf() == s.rdbuf());
+        assert(new_called != 0);
+    }
+    assert(new_called == 0);
+    {
+        std::stringstream s;
+        B b(s.rdbuf(), new std::codecvt_utf8<wchar_t>, std::mbstate_t());
+        assert(b.rdbuf() == s.rdbuf());
+        assert(new_called != 0);
+    }
+    assert(new_called == 0);
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/overflow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/overflow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/overflow.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/overflow.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,100 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// wbuffer_convert<Codecvt, Elem, Tr>
+
+// int_type overflow(int_type c = traits::eof());
+
+// This test is not entirely portable
+
+#include <locale>
+#include <codecvt>
+#include <fstream>
+#include <cassert>
+
+struct test_buf
+    : public std::wbuffer_convert<std::codecvt_utf8<wchar_t> >
+{
+    typedef std::wbuffer_convert<std::codecvt_utf8<wchar_t> > base;
+    typedef base::char_type   char_type;
+    typedef base::int_type    int_type;
+    typedef base::traits_type traits_type;
+
+    explicit test_buf(std::streambuf* sb) : base(sb) {}
+
+    char_type* pbase() const {return base::pbase();}
+    char_type* pptr()  const {return base::pptr();}
+    char_type* epptr() const {return base::epptr();}
+    void gbump(int n) {base::gbump(n);}
+
+    virtual int_type overflow(int_type c = traits_type::eof()) {return base::overflow(c);}
+};
+
+int main()
+{
+    {
+        std::ofstream bs("overflow.dat");
+        test_buf f(bs.rdbuf());
+        assert(f.pbase() == 0);
+        assert(f.pptr() == 0);
+        assert(f.epptr() == 0);
+        assert(f.overflow(L'a') == L'a');
+        assert(f.pbase() != 0);
+        assert(f.pptr() == f.pbase());
+        assert(f.epptr() - f.pbase() == 4095);
+    }
+    {
+        std::ifstream bs("overflow.dat");
+        test_buf f(bs.rdbuf());
+        assert(f.sgetc() == L'a');
+    }
+    std::remove("overflow.dat");
+    {
+        std::ofstream bs("overflow.dat");
+        test_buf f(bs.rdbuf());
+        f.pubsetbuf(0, 0);
+        assert(f.pbase() == 0);
+        assert(f.pptr() == 0);
+        assert(f.epptr() == 0);
+        assert(f.overflow('a') == 'a');
+        assert(f.pbase() == 0);
+        assert(f.pptr() == 0);
+        assert(f.epptr() == 0);
+    }
+    {
+        std::ifstream bs("overflow.dat");
+        test_buf f(bs.rdbuf());
+        assert(f.sgetc() == L'a');
+    }
+    std::remove("overflow.dat");
+    {
+        std::ofstream bs("overflow.dat");
+        test_buf f(bs.rdbuf());
+        assert(f.sputc(0x4E51) == 0x4E51);
+        assert(f.sputc(0x4E52) == 0x4E52);
+        assert(f.sputc(0x4E53) == 0x4E53);
+    }
+    {
+        std::ifstream f("overflow.dat");
+        assert(f.is_open());
+        assert(f.get() == 0xE4);
+        assert(f.get() == 0xB9);
+        assert(f.get() == 0x91);
+        assert(f.get() == 0xE4);
+        assert(f.get() == 0xB9);
+        assert(f.get() == 0x92);
+        assert(f.get() == 0xE4);
+        assert(f.get() == 0xB9);
+        assert(f.get() == 0x93);
+        assert(f.get() == -1);
+    }
+    std::remove("overflow.dat");
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// wbuffer_convert<Codecvt, Elem, Tr>
+
+// int_type pbackfail(int_type c = traits::eof());
+
+// This test is not entirely portable
+
+#include <locale>
+#include <codecvt>
+#include <fstream>
+#include <cassert>
+
+struct test_buf
+    : public std::wbuffer_convert<std::codecvt_utf8<wchar_t> >
+{
+    typedef std::wbuffer_convert<std::codecvt_utf8<wchar_t> > base;
+    typedef base::char_type   char_type;
+    typedef base::int_type    int_type;
+    typedef base::traits_type traits_type;
+
+    explicit test_buf(std::streambuf* sb) : base(sb) {}
+
+    char_type* eback() const {return base::eback();}
+    char_type* gptr()  const {return base::gptr();}
+    char_type* egptr() const {return base::egptr();}
+    void gbump(int n) {base::gbump(n);}
+
+    virtual int_type pbackfail(int_type c = traits_type::eof()) {return base::pbackfail(c);}
+};
+
+int main()
+{
+    {
+        std::ifstream bs("underflow.dat");
+        test_buf f(bs.rdbuf());
+        assert(f.sbumpc() == L'1');
+        assert(f.sgetc() == L'2');
+        assert(f.pbackfail(L'a') == test_buf::traits_type::eof());
+    }
+    {
+        std::fstream bs("underflow.dat");
+        test_buf f(bs.rdbuf());
+        assert(f.sbumpc() == L'1');
+        assert(f.sgetc() == L'2');
+        assert(f.pbackfail(L'a') == test_buf::traits_type::eof());
+        assert(f.sbumpc() == L'2');
+        assert(f.sgetc() == L'3');
+    }
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/rdbuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/rdbuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/rdbuf.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/rdbuf.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// wbuffer_convert<Codecvt, Elem, Tr>
+
+// streambuf *rdbuf(streambuf *bytebuf);
+
+#include <locale>
+#include <codecvt>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    typedef std::wbuffer_convert<std::codecvt_utf8<wchar_t> > B;
+    {
+        std::stringstream s;
+        B b;
+        assert(b.rdbuf() == nullptr);
+        b.rdbuf(s.rdbuf());
+        assert(b.rdbuf() == s.rdbuf());
+    }
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/seekoff.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/seekoff.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/seekoff.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/seekoff.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// wbuffer_convert<Codecvt, Elem, Tr>
+
+// pos_type seekoff(off_type off, ios_base::seekdir way,
+//                  ios_base::openmode which = ios_base::in | ios_base::out);
+// pos_type seekpos(pos_type sp,
+//                  ios_base::openmode which = ios_base::in | ios_base::out);
+
+// This test is not entirely portable
+
+#include <locale>
+#include <codecvt>
+#include <fstream>
+#include <cassert>
+
+class test_codecvt
+    : public std::codecvt<wchar_t, char, std::mbstate_t>
+{
+    typedef std::codecvt<wchar_t, char, std::mbstate_t> base;
+public:
+    explicit test_codecvt(std::size_t refs = 0) : base(refs) {}
+    ~test_codecvt() {}
+};
+
+int main()
+{
+    {
+        wchar_t buf[10];
+        typedef std::wbuffer_convert<test_codecvt> test_buf;
+        typedef test_buf::pos_type pos_type;
+        std::fstream bs("seekoff.dat", std::ios::trunc | std::ios::in
+                                                       | std::ios::out);
+        test_buf f(bs.rdbuf());
+        f.pubsetbuf(buf, sizeof(buf)/sizeof(buf[0]));
+        f.sputn(L"abcdefghijklmnopqrstuvwxyz", 26);
+        assert(buf[0] == L'v');
+        pos_type p = f.pubseekoff(-15, std::ios_base::cur);
+        assert(p == 11);
+        assert(f.sgetc() == L'l');
+        f.pubseekoff(0, std::ios_base::beg);
+        assert(f.sgetc() == L'a');
+        f.pubseekoff(-1, std::ios_base::end);
+        assert(f.sgetc() == L'z');
+        assert(f.pubseekpos(p) == p);
+        assert(f.sgetc() == L'l');
+    }
+    std::remove("seekoff.dat");
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/state.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/state.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/state.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/state.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// wbuffer_convert<Codecvt, Elem, Tr>
+
+// state_type state() const;
+
+#include <locale>
+#include <codecvt>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    typedef std::wbuffer_convert<std::codecvt_utf8<wchar_t> > B;
+    {
+        B b;
+        std::mbstate_t s = b.state();
+    }
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/test.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/test.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/test.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// wbuffer_convert<Codecvt, Elem, Tr>
+
+#include <fstream>
+#include <locale>
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ofstream bytestream("myfile.txt");
+        std::wbuffer_convert<std::codecvt_utf8<wchar_t> > mybuf(bytestream.rdbuf());
+        std::wostream mystr(&mybuf);
+        mystr << L"Hello" << std::endl;
+    }
+    {
+        std::ifstream bytestream("myfile.txt");
+        std::wbuffer_convert<std::codecvt_utf8<wchar_t> > mybuf(bytestream.rdbuf());
+        std::wistream mystr(&mybuf);
+        std::wstring ws;
+        mystr >> ws;
+        assert(ws == L"Hello");
+    }
+    std::remove("myfile.txt");
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.dat
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.dat?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.dat (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.dat Fri Dec 19 19:40:03 2014
@@ -0,0 +1 @@
+123456789
\ No newline at end of file

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// wbuffer_convert<Codecvt, Elem, Tr>
+
+// int_type underflow();
+
+// This test is not entirely portable
+
+#include <locale>
+#include <codecvt>
+#include <fstream>
+#include <cassert>
+
+struct test_buf
+    : public std::wbuffer_convert<std::codecvt_utf8<wchar_t> >
+{
+    typedef std::wbuffer_convert<std::codecvt_utf8<wchar_t> > base;
+    typedef base::char_type   char_type;
+    typedef base::int_type    int_type;
+    typedef base::traits_type traits_type;
+
+    explicit test_buf(std::streambuf* sb) : base(sb) {}
+
+    char_type* eback() const {return base::eback();}
+    char_type* gptr()  const {return base::gptr();}
+    char_type* egptr() const {return base::egptr();}
+    void gbump(int n) {base::gbump(n);}
+
+    virtual int_type underflow() {return base::underflow();}
+};
+
+int main()
+{
+    {
+        std::ifstream bs("underflow.dat");
+        test_buf f(bs.rdbuf());
+        assert(f.eback() == 0);
+        assert(f.gptr() == 0);
+        assert(f.egptr() == 0);
+        assert(f.underflow() == L'1');
+        assert(f.eback() != 0);
+        assert(f.eback() == f.gptr());
+        assert(*f.gptr() == L'1');
+        assert(f.egptr() - f.eback() == 9);
+    }
+    {
+        std::ifstream bs("underflow.dat");
+        test_buf f(bs.rdbuf());
+        assert(f.eback() == 0);
+        assert(f.gptr() == 0);
+        assert(f.egptr() == 0);
+        assert(f.underflow() == L'1');
+        assert(f.eback() != 0);
+        assert(f.eback() == f.gptr());
+        assert(*f.gptr() == L'1');
+        assert(f.egptr() - f.eback() == 9);
+        f.gbump(8);
+        assert(f.sgetc() == L'9');
+        assert(f.eback()[0] == L'1');
+        assert(f.eback()[1] == L'2');
+        assert(f.eback()[2] == L'3');
+        assert(f.eback()[3] == L'4');
+        assert(f.gptr() - f.eback() == 8);
+        assert(*f.gptr() == L'9');
+        assert(f.egptr() - f.gptr() == 1);
+    }
+    {
+        std::ifstream bs("underflow_utf8.dat");
+        test_buf f(bs.rdbuf());
+        assert(f.sbumpc() == 0x4E51);
+        assert(f.sbumpc() == 0x4E52);
+        assert(f.sbumpc() == 0x4E53);
+        assert(f.sbumpc() == test_buf::traits_type::eof());
+    }
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow_utf8.dat
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow_utf8.dat?rev=224658&view=auto
==============================================================================
Binary file - no diff available.

Propchange: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow_utf8.dat
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.character/tolower.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.character/tolower.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.character/tolower.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.character/tolower.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> charT tolower(charT c, const locale& loc);
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l;
+    assert(std::tolower(' ', l) == ' ');
+    assert(std::tolower('<', l) == '<');
+    assert(std::tolower('\x8', l) == '\x8');
+    assert(std::tolower('A', l) == 'a');
+    assert(std::tolower('a', l) == 'a');
+    assert(std::tolower('z', l) == 'z');
+    assert(std::tolower('3', l) == '3');
+    assert(std::tolower('.', l) == '.');
+    assert(std::tolower('f', l) == 'f');
+    assert(std::tolower('9', l) == '9');
+    assert(std::tolower('+', l) == '+');
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.character/toupper.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.character/toupper.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.character/toupper.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.character/toupper.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT> charT toupper(charT c, const locale& loc);
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    std::locale l;
+    assert(std::toupper(' ', l) == ' ');
+    assert(std::toupper('<', l) == '<');
+    assert(std::toupper('\x8', l) == '\x8');
+    assert(std::toupper('A', l) == 'A');
+    assert(std::toupper('a', l) == 'A');
+    assert(std::toupper('z', l) == 'Z');
+    assert(std::toupper('3', l) == '3');
+    assert(std::toupper('.', l) == '.');
+    assert(std::toupper('f', l) == 'F');
+    assert(std::toupper('9', l) == '9');
+    assert(std::toupper('+', l) == '+');
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
+
+// size_t converted() const;
+
+#include <locale>
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    typedef std::codecvt_utf8<wchar_t> Codecvt;
+    typedef std::wstring_convert<Codecvt> Myconv;
+    Myconv myconv;
+    assert(myconv.converted() == 0);
+    std::string bs = myconv.to_bytes(L"\x40003");
+    assert(myconv.converted() == 1);
+    bs = myconv.to_bytes(L"\x40003\x65");
+    assert(myconv.converted() == 2);
+    std::wstring ws = myconv.from_bytes("\xF1\x80\x80\x83");
+    assert(myconv.converted() == 4);
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
+
+// wstring_convert(Codecvt* pcvt = new Codecvt);
+
+#include <locale>
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf8<wchar_t> Codecvt;
+        typedef std::wstring_convert<Codecvt> Myconv;
+        Myconv myconv;
+        assert(myconv.converted() == 0);
+    }
+    {
+        typedef std::codecvt_utf8<wchar_t> Codecvt;
+        typedef std::wstring_convert<Codecvt> Myconv;
+        Myconv myconv(new Codecvt);
+        assert(myconv.converted() == 0);
+#if _LIBCPP_STD_VER > 11
+        static_assert(!std::is_convertible<Codecvt*, Myconv>::value, "");
+        static_assert( std::is_constructible<Myconv, Codecvt*>::value, "");
+#endif
+    }
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt_state.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt_state.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt_state.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt_state.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
+
+// wstring_convert(Codecvt* pcvt, state_type state);
+
+#include <locale>
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef std::codecvt_utf8<wchar_t> Codecvt;
+        typedef std::wstring_convert<Codecvt> Myconv;
+        Myconv myconv(new Codecvt, std::mbstate_t());
+        assert(myconv.converted() == 0);
+    }
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
+
+// wstring_convert(const byte_string& byte_err,
+//                 const wide_string& wide_err = wide_string());
+
+#include <locale>
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    typedef std::codecvt_utf8<wchar_t> Codecvt;
+    typedef std::wstring_convert<Codecvt> Myconv;
+#if _LIBCPP_STD_VER > 11
+    static_assert(!std::is_convertible<std::string, Myconv>::value, "");
+    static_assert( std::is_constructible<Myconv, std::string>::value, "");
+#endif
+    {
+        Myconv myconv;
+        try
+        {
+            myconv.to_bytes(L"\xDA83");
+            assert(false);
+        }
+        catch (const std::range_error&)
+        {
+        }
+        try
+        {
+            myconv.from_bytes('\xA5');
+            assert(false);
+        }
+        catch (const std::range_error&)
+        {
+        }
+    }
+    {
+        Myconv myconv("byte error");
+        std::string bs = myconv.to_bytes(L"\xDA83");
+        assert(bs == "byte error");
+        try
+        {
+            myconv.from_bytes('\xA5');
+            assert(false);
+        }
+        catch (const std::range_error&)
+        {
+        }
+    }
+    {
+        Myconv myconv("byte error", L"wide error");
+        std::string bs = myconv.to_bytes(L"\xDA83");
+        assert(bs == "byte error");
+        std::wstring ws = myconv.from_bytes('\xA5');
+        assert(ws == L"wide error");
+    }
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
+
+// wide_string from_bytes(char byte);
+// wide_string from_bytes(const char* ptr);
+// wide_string from_bytes(const byte_string& str);
+// wide_string from_bytes(const char* first, const char* last);
+
+#include <locale>
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        std::wstring_convert<std::codecvt_utf8<wchar_t> > myconv;
+        std::string bs("\xF1\x80\x80\x83");
+        std::wstring ws = myconv.from_bytes('a');
+        assert(ws == L"a");
+        ws = myconv.from_bytes(bs.c_str());
+        assert(ws == L"\x40003");
+        ws = myconv.from_bytes(bs);
+        assert(ws == L"\x40003");
+        ws = myconv.from_bytes(bs.data(), bs.data() + bs.size());
+        assert(ws == L"\x40003");
+        ws = myconv.from_bytes("");
+        assert(ws.size() == 0);
+    }
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/state.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/state.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/state.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/state.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
+
+// state_type state() const;
+
+#include <locale>
+#include <codecvt>
+
+int main()
+{
+    typedef std::codecvt_utf8<wchar_t> Codecvt;
+    typedef std::wstring_convert<Codecvt> Myconv;
+    Myconv myconv;
+    std::mbstate_t s = myconv.state();
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
+
+// byte_string to_bytes(Elem wchar);
+// byte_string to_bytes(const Elem* wptr);
+// byte_string to_bytes(const wide_string& wstr);
+// byte_string to_bytes(const Elem* first, const Elem* last);
+
+#include <locale>
+#include <codecvt>
+#include <cassert>
+
+int main()
+{
+    {
+        std::wstring_convert<std::codecvt_utf8<wchar_t> > myconv;
+        std::wstring ws(1, L'\x40003');
+        std::string bs = myconv.to_bytes(ws[0]);
+        assert(bs == "\xF1\x80\x80\x83");
+        bs = myconv.to_bytes(ws.c_str());
+        assert(bs == "\xF1\x80\x80\x83");
+        bs = myconv.to_bytes(ws);
+        assert(bs == "\xF1\x80\x80\x83");
+        bs = myconv.to_bytes(ws.data(), ws.data() + ws.size());
+        assert(bs == "\xF1\x80\x80\x83");
+        bs = myconv.to_bytes(L"");
+        assert(bs.size() == 0);
+    }
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/types.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template<class Codecvt, class Elem = wchar_t,
+//          class Wide_alloc = allocator<Elem>,
+//          class Byte_alloc = allocator<char>>
+// class wstring_convert
+// {
+// public:
+//     typedef basic_string<char, char_traits<char>, Byte_alloc> byte_string;
+//     typedef basic_string<Elem, char_traits<Elem>, Wide_alloc> wide_string;
+//     typedef typename Codecvt::state_type                      state_type;
+//     typedef typename wide_string::traits_type::int_type       int_type;
+
+#include <locale>
+#include <codecvt>
+
+int main()
+{
+    {
+        typedef std::wstring_convert<std::codecvt_utf8<wchar_t> > myconv;
+        static_assert((std::is_same<myconv::byte_string, std::string>::value), "");
+        static_assert((std::is_same<myconv::wide_string, std::wstring>::value), "");
+        static_assert((std::is_same<myconv::state_type, std::mbstate_t>::value), "");
+        static_assert((std::is_same<myconv::int_type, std::char_traits<wchar_t>::int_type>::value), "");
+    }
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locales/locale.convenience/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.convenience/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.convenience/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locales/locale.global.templates/has_facet.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.global.templates/has_facet.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.global.templates/has_facet.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.global.templates/has_facet.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class Facet> bool has_facet(const locale& loc) throw();
+
+#include <locale>
+#include <cassert>
+
+struct my_facet
+    : public std::locale::facet
+{
+    static std::locale::id id;
+};
+
+std::locale::id my_facet::id;
+
+int main()
+{
+    std::locale loc;
+    assert(std::has_facet<std::ctype<char> >(loc));
+    assert(!std::has_facet<my_facet>(loc));
+    std::locale loc2(loc, new my_facet);
+    assert(std::has_facet<my_facet>(loc2));
+}

Added: libcxx/trunk/test/std/localization/locales/locale.global.templates/use_facet.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.global.templates/use_facet.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale.global.templates/use_facet.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale.global.templates/use_facet.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class Facet> const Facet& use_facet(const locale& loc);
+
+#include <locale>
+#include <cassert>
+
+int facet_count = 0;
+
+struct my_facet
+    : public std::locale::facet
+{
+    static std::locale::id id;
+
+    bool im_alive;
+
+    my_facet() : im_alive(true) {++facet_count;}
+    ~my_facet() {im_alive = false; --facet_count;}
+};
+
+std::locale::id my_facet::id;
+
+int main()
+{
+    try
+    {
+        const my_facet& f = std::use_facet<my_facet>(std::locale());
+        assert(false);
+    }
+    catch (std::bad_cast&)
+    {
+    }
+    const my_facet* fp = 0;
+    {
+        std::locale loc(std::locale(), new my_facet);
+        const my_facet& f = std::use_facet<my_facet>(loc);
+        assert(f.im_alive);
+        fp = &f;
+        assert(fp->im_alive);
+        assert(facet_count == 1);
+    }
+    assert(facet_count == 0);
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.cons/assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/assign.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/assign.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.ru_RU.UTF-8
+// UNSUPPORTED: msan, asan
+
+// <locale>
+
+// const locale& operator=(const locale& other) throw();
+
+#include <locale>
+#include <cassert>
+#include <new>
+
+#include "platform_support.h" // locale name macros
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+void check(const std::locale& loc)
+{
+    assert(std::has_facet<std::collate<char> >(loc));
+    assert(std::has_facet<std::collate<wchar_t> >(loc));
+
+    assert(std::has_facet<std::ctype<char> >(loc));
+    assert(std::has_facet<std::ctype<wchar_t> >(loc));
+    assert((std::has_facet<std::codecvt<char, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char16_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char32_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(loc)));
+
+    assert((std::has_facet<std::moneypunct<char> >(loc)));
+    assert((std::has_facet<std::moneypunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_get<char> >(loc)));
+    assert((std::has_facet<std::money_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_put<char> >(loc)));
+    assert((std::has_facet<std::money_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::numpunct<char> >(loc)));
+    assert((std::has_facet<std::numpunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_get<char> >(loc)));
+    assert((std::has_facet<std::num_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_put<char> >(loc)));
+    assert((std::has_facet<std::num_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::time_get<char> >(loc)));
+    assert((std::has_facet<std::time_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::time_put<char> >(loc)));
+    assert((std::has_facet<std::time_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::messages<char> >(loc)));
+    assert((std::has_facet<std::messages<wchar_t> >(loc)));
+}
+
+int main()
+{
+    {
+        std::locale loc(LOCALE_ru_RU_UTF_8);
+        std::locale loc2;
+        loc2 = loc;
+        assert(loc == loc2);
+        check(loc);
+        check(loc2);
+    }
+    assert(new_called == 0);
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,104 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+// UNSUPPORTED: msan, asan
+
+// <locale>
+
+// explicit locale(const char* std_name);
+
+#include <locale>
+#include <new>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+void check(const std::locale& loc)
+{
+    assert(std::has_facet<std::collate<char> >(loc));
+    assert(std::has_facet<std::collate<wchar_t> >(loc));
+
+    assert(std::has_facet<std::ctype<char> >(loc));
+    assert(std::has_facet<std::ctype<wchar_t> >(loc));
+    assert((std::has_facet<std::codecvt<char, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char16_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char32_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(loc)));
+
+    assert((std::has_facet<std::moneypunct<char> >(loc)));
+    assert((std::has_facet<std::moneypunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_get<char> >(loc)));
+    assert((std::has_facet<std::money_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_put<char> >(loc)));
+    assert((std::has_facet<std::money_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::numpunct<char> >(loc)));
+    assert((std::has_facet<std::numpunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_get<char> >(loc)));
+    assert((std::has_facet<std::num_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_put<char> >(loc)));
+    assert((std::has_facet<std::num_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::time_get<char> >(loc)));
+    assert((std::has_facet<std::time_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::time_put<char> >(loc)));
+    assert((std::has_facet<std::time_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::messages<char> >(loc)));
+    assert((std::has_facet<std::messages<wchar_t> >(loc)));
+}
+
+int main()
+{
+    {
+        std::locale loc(LOCALE_ru_RU_UTF_8);
+        check(loc);
+        std::locale loc2(LOCALE_ru_RU_UTF_8);
+        check(loc2);
+        assert(loc == loc2);
+        std::locale loc3(LOCALE_zh_CN_UTF_8);
+        check(loc3);
+        assert(!(loc == loc3));
+        assert(loc != loc3);
+        try
+        {
+            std::locale((const char*)0);
+            assert(false);
+        }
+        catch (std::runtime_error&)
+        {
+        }
+        try
+        {
+            std::locale("spazbot");
+            assert(false);
+        }
+        catch (std::runtime_error&)
+        {
+        }
+        std::locale ok("");
+    }
+    assert(new_called == 0);
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.cons/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/copy.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,82 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.fr_FR.UTF-8
+// UNSUPPORTED: msan, asan
+
+// <locale>
+
+// locale(const locale& other) throw();
+
+#include <locale>
+#include <cassert>
+#include <new>
+
+#include "platform_support.h" // locale name macros
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+void check(const std::locale& loc)
+{
+    assert(std::has_facet<std::collate<char> >(loc));
+    assert(std::has_facet<std::collate<wchar_t> >(loc));
+
+    assert(std::has_facet<std::ctype<char> >(loc));
+    assert(std::has_facet<std::ctype<wchar_t> >(loc));
+    assert((std::has_facet<std::codecvt<char, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char16_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char32_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(loc)));
+
+    assert((std::has_facet<std::moneypunct<char> >(loc)));
+    assert((std::has_facet<std::moneypunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_get<char> >(loc)));
+    assert((std::has_facet<std::money_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_put<char> >(loc)));
+    assert((std::has_facet<std::money_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::numpunct<char> >(loc)));
+    assert((std::has_facet<std::numpunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_get<char> >(loc)));
+    assert((std::has_facet<std::num_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_put<char> >(loc)));
+    assert((std::has_facet<std::num_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::time_get<char> >(loc)));
+    assert((std::has_facet<std::time_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::time_put<char> >(loc)));
+    assert((std::has_facet<std::time_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::messages<char> >(loc)));
+    assert((std::has_facet<std::messages<wchar_t> >(loc)));
+}
+
+int main()
+{
+    {
+        std::locale loc(LOCALE_fr_FR_UTF_8);
+        std::locale loc2 = loc;
+        assert(loc == loc2);
+        check(loc);
+        check(loc2);
+    }
+    assert(new_called == 0);
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// locale() throw();
+
+// UNSUPPORTED: asan, msan
+
+#include <locale>
+#include <new>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+void check(const std::locale& loc)
+{
+    assert(std::has_facet<std::collate<char> >(loc));
+    assert(std::has_facet<std::collate<wchar_t> >(loc));
+
+    assert(std::has_facet<std::ctype<char> >(loc));
+    assert(std::has_facet<std::ctype<wchar_t> >(loc));
+    assert((std::has_facet<std::codecvt<char, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char16_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char32_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(loc)));
+
+    assert((std::has_facet<std::moneypunct<char> >(loc)));
+    assert((std::has_facet<std::moneypunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_get<char> >(loc)));
+    assert((std::has_facet<std::money_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_put<char> >(loc)));
+    assert((std::has_facet<std::money_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::numpunct<char> >(loc)));
+    assert((std::has_facet<std::numpunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_get<char> >(loc)));
+    assert((std::has_facet<std::num_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_put<char> >(loc)));
+    assert((std::has_facet<std::num_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::time_get<char> >(loc)));
+    assert((std::has_facet<std::time_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::time_put<char> >(loc)));
+    assert((std::has_facet<std::time_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::messages<char> >(loc)));
+    assert((std::has_facet<std::messages<wchar_t> >(loc)));
+}
+
+int main()
+{
+    int ok;
+    {
+        std::locale loc;
+        assert(new_called == 0);
+        assert(loc.name() == "C");
+        assert(new_called == 0);
+        check(loc);
+        assert(new_called == 0);
+        assert(std::locale::global(std::locale(LOCALE_en_US_UTF_8)) == loc);
+        ok = new_called;
+        std::locale loc2;
+        assert(new_called == ok);
+        check(loc2);
+        assert(new_called == ok);
+        assert(loc2 == std::locale(LOCALE_en_US_UTF_8));
+        assert(new_called == ok);
+    }
+    assert(new_called == ok);
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,82 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// UNSUPPORTED: msan, asan
+
+// <locale>
+
+// locale(const locale& other, const char* std_name, category);
+
+#include <locale>
+#include <new>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+void check(const std::locale& loc)
+{
+    assert(std::has_facet<std::collate<char> >(loc));
+    assert(std::has_facet<std::collate<wchar_t> >(loc));
+
+    assert(std::has_facet<std::ctype<char> >(loc));
+    assert(std::has_facet<std::ctype<wchar_t> >(loc));
+    assert((std::has_facet<std::codecvt<char, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char16_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char32_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(loc)));
+
+    assert((std::has_facet<std::moneypunct<char> >(loc)));
+    assert((std::has_facet<std::moneypunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_get<char> >(loc)));
+    assert((std::has_facet<std::money_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_put<char> >(loc)));
+    assert((std::has_facet<std::money_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::numpunct<char> >(loc)));
+    assert((std::has_facet<std::numpunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_get<char> >(loc)));
+    assert((std::has_facet<std::num_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_put<char> >(loc)));
+    assert((std::has_facet<std::num_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::time_get<char> >(loc)));
+    assert((std::has_facet<std::time_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::time_put<char> >(loc)));
+    assert((std::has_facet<std::time_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::messages<char> >(loc)));
+    assert((std::has_facet<std::messages<wchar_t> >(loc)));
+}
+
+int main()
+{
+    {
+        std::locale loc(LOCALE_ru_RU_UTF_8);
+        check(loc);
+        std::locale loc2(loc, LOCALE_en_US_UTF_8, std::locale::monetary);
+        check(loc2);
+    }
+    assert(new_called == 0);
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,106 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.ru_RU.UTF-8
+// UNSUPPORTED: msan, asan
+
+// <locale>
+
+// template <class Facet> locale(const locale& other, Facet* f);
+
+#include <locale>
+#include <new>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+void check(const std::locale& loc)
+{
+    assert(std::has_facet<std::collate<char> >(loc));
+    assert(std::has_facet<std::collate<wchar_t> >(loc));
+
+    assert(std::has_facet<std::ctype<char> >(loc));
+    assert(std::has_facet<std::ctype<wchar_t> >(loc));
+    assert((std::has_facet<std::codecvt<char, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char16_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char32_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(loc)));
+
+    assert((std::has_facet<std::moneypunct<char> >(loc)));
+    assert((std::has_facet<std::moneypunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_get<char> >(loc)));
+    assert((std::has_facet<std::money_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_put<char> >(loc)));
+    assert((std::has_facet<std::money_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::numpunct<char> >(loc)));
+    assert((std::has_facet<std::numpunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_get<char> >(loc)));
+    assert((std::has_facet<std::num_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_put<char> >(loc)));
+    assert((std::has_facet<std::num_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::time_get<char> >(loc)));
+    assert((std::has_facet<std::time_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::time_put<char> >(loc)));
+    assert((std::has_facet<std::time_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::messages<char> >(loc)));
+    assert((std::has_facet<std::messages<wchar_t> >(loc)));
+}
+
+struct my_facet
+    : public std::locale::facet
+{
+    int test() const {return 5;}
+
+    static std::locale::id id;
+};
+
+std::locale::id my_facet::id;
+
+int main()
+{
+{
+    {
+        std::locale loc(LOCALE_ru_RU_UTF_8);
+        check(loc);
+        std::locale loc2(loc, new my_facet);
+        check(loc2);
+        assert((std::has_facet<my_facet>(loc2)));
+        const my_facet& f = std::use_facet<my_facet>(loc2);
+        assert(f.test() == 5);
+    }
+    assert(new_called == 0);
+}
+{
+    {
+        std::locale loc;
+        check(loc);
+        std::locale loc2(loc, (std::ctype<char>*)0);
+        check(loc2);
+        assert(loc == loc2);
+    }
+    assert(new_called == 0);
+}
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,82 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.ru_RU.UTF-8
+// UNSUPPORTED: msan, asan
+
+// <locale>
+
+// locale(const locale& other, const locale& one, category cats);
+
+#include <locale>
+#include <new>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+void check(const std::locale& loc)
+{
+    assert(std::has_facet<std::collate<char> >(loc));
+    assert(std::has_facet<std::collate<wchar_t> >(loc));
+
+    assert(std::has_facet<std::ctype<char> >(loc));
+    assert(std::has_facet<std::ctype<wchar_t> >(loc));
+    assert((std::has_facet<std::codecvt<char, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char16_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char32_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(loc)));
+
+    assert((std::has_facet<std::moneypunct<char> >(loc)));
+    assert((std::has_facet<std::moneypunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_get<char> >(loc)));
+    assert((std::has_facet<std::money_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_put<char> >(loc)));
+    assert((std::has_facet<std::money_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::numpunct<char> >(loc)));
+    assert((std::has_facet<std::numpunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_get<char> >(loc)));
+    assert((std::has_facet<std::num_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_put<char> >(loc)));
+    assert((std::has_facet<std::num_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::time_get<char> >(loc)));
+    assert((std::has_facet<std::time_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::time_put<char> >(loc)));
+    assert((std::has_facet<std::time_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::messages<char> >(loc)));
+    assert((std::has_facet<std::messages<wchar_t> >(loc)));
+}
+
+int main()
+{
+    {
+        std::locale loc(LOCALE_ru_RU_UTF_8);
+        check(loc);
+        std::locale loc2(loc, std::locale(LOCALE_en_US_UTF_8), std::locale::monetary);
+        check(loc2);
+    }
+    assert(new_called == 0);
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.ru_RU.UTF-8
+// UNSUPPORTED: msan, asan
+
+// <locale>
+
+// locale(const locale& other, const string& std_name, category cat);
+
+#include <locale>
+#include <new>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+void check(const std::locale& loc)
+{
+    assert(std::has_facet<std::collate<char> >(loc));
+    assert(std::has_facet<std::collate<wchar_t> >(loc));
+
+    assert(std::has_facet<std::ctype<char> >(loc));
+    assert(std::has_facet<std::ctype<wchar_t> >(loc));
+    assert((std::has_facet<std::codecvt<char, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char16_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char32_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(loc)));
+
+    assert((std::has_facet<std::moneypunct<char> >(loc)));
+    assert((std::has_facet<std::moneypunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_get<char> >(loc)));
+    assert((std::has_facet<std::money_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_put<char> >(loc)));
+    assert((std::has_facet<std::money_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::numpunct<char> >(loc)));
+    assert((std::has_facet<std::numpunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_get<char> >(loc)));
+    assert((std::has_facet<std::num_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_put<char> >(loc)));
+    assert((std::has_facet<std::num_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::time_get<char> >(loc)));
+    assert((std::has_facet<std::time_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::time_put<char> >(loc)));
+    assert((std::has_facet<std::time_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::messages<char> >(loc)));
+    assert((std::has_facet<std::messages<wchar_t> >(loc)));
+}
+
+int main()
+{
+    {
+        std::locale loc(LOCALE_ru_RU_UTF_8);
+        check(loc);
+        std::locale loc2(loc, std::string(LOCALE_en_US_UTF_8), std::locale::monetary);
+        check(loc2);
+    }
+    assert(new_called == 0);
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.cons/string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.cons/string.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.cons/string.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.cons/string.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.ru_RU.UTF-8
+// REQUIRES: locale.zh_CN.UTF-8
+// UNSUPPORTED: msan, asan
+
+// <locale>
+
+// explicit locale(const string& std_name);
+
+#include <locale>
+#include <new>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+void check(const std::locale& loc)
+{
+    assert(std::has_facet<std::collate<char> >(loc));
+    assert(std::has_facet<std::collate<wchar_t> >(loc));
+
+    assert(std::has_facet<std::ctype<char> >(loc));
+    assert(std::has_facet<std::ctype<wchar_t> >(loc));
+    assert((std::has_facet<std::codecvt<char, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char16_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char32_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(loc)));
+
+    assert((std::has_facet<std::moneypunct<char> >(loc)));
+    assert((std::has_facet<std::moneypunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_get<char> >(loc)));
+    assert((std::has_facet<std::money_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_put<char> >(loc)));
+    assert((std::has_facet<std::money_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::numpunct<char> >(loc)));
+    assert((std::has_facet<std::numpunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_get<char> >(loc)));
+    assert((std::has_facet<std::num_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_put<char> >(loc)));
+    assert((std::has_facet<std::num_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::time_get<char> >(loc)));
+    assert((std::has_facet<std::time_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::time_put<char> >(loc)));
+    assert((std::has_facet<std::time_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::messages<char> >(loc)));
+    assert((std::has_facet<std::messages<wchar_t> >(loc)));
+}
+
+int main()
+{
+    {
+        std::locale loc(std::string(LOCALE_ru_RU_UTF_8));
+        check(loc);
+        std::locale loc2(std::string(LOCALE_ru_RU_UTF_8));
+        check(loc2);
+        assert(loc == loc2);
+        std::locale loc3(std::string(LOCALE_zh_CN_UTF_8));
+        check(loc3);
+        assert(!(loc == loc3));
+        assert(loc != loc3);
+    }
+    assert(new_called == 0);
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.members/combine.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.members/combine.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.members/combine.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.members/combine.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,109 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class Facet> locale combine(const locale& other) const;
+
+// UNSUPPORTED: asan, msan
+
+#include <locale>
+#include <new>
+#include <cassert>
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+void check(const std::locale& loc)
+{
+    assert(std::has_facet<std::collate<char> >(loc));
+    assert(std::has_facet<std::collate<wchar_t> >(loc));
+
+    assert(std::has_facet<std::ctype<char> >(loc));
+    assert(std::has_facet<std::ctype<wchar_t> >(loc));
+    assert((std::has_facet<std::codecvt<char, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char16_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char32_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(loc)));
+
+    assert((std::has_facet<std::moneypunct<char> >(loc)));
+    assert((std::has_facet<std::moneypunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_get<char> >(loc)));
+    assert((std::has_facet<std::money_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_put<char> >(loc)));
+    assert((std::has_facet<std::money_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::numpunct<char> >(loc)));
+    assert((std::has_facet<std::numpunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_get<char> >(loc)));
+    assert((std::has_facet<std::num_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_put<char> >(loc)));
+    assert((std::has_facet<std::num_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::time_get<char> >(loc)));
+    assert((std::has_facet<std::time_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::time_put<char> >(loc)));
+    assert((std::has_facet<std::time_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::messages<char> >(loc)));
+    assert((std::has_facet<std::messages<wchar_t> >(loc)));
+}
+
+struct my_facet
+    : public std::locale::facet
+{
+    int test() const {return 5;}
+
+    static std::locale::id id;
+};
+
+std::locale::id my_facet::id;
+
+int main()
+{
+{
+    {
+        std::locale loc;
+        std::locale loc2(loc, new my_facet);
+        std::locale loc3 = loc.combine<my_facet>(loc2);
+        check(loc3);
+        assert(loc3.name() == "*");
+        assert((std::has_facet<my_facet>(loc3)));
+        const my_facet& f = std::use_facet<my_facet>(loc3);
+        assert(f.test() == 5);
+    }
+    assert(new_called == 0);
+}
+{
+    {
+        std::locale loc;
+        std::locale loc2;
+        try
+        {
+            std::locale loc3 = loc.combine<my_facet>(loc2);
+            assert(false);
+        }
+        catch (std::runtime_error&)
+        {
+        }
+    }
+    assert(new_called == 0);
+}
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.members/name.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.members/name.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.members/name.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.members/name.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// basic_string<char> name() const;
+
+#include <locale>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    {
+        std::locale loc;
+        assert(loc.name() == "C");
+    }
+    {
+        std::locale loc(LOCALE_en_US_UTF_8);
+        assert(loc.name() == LOCALE_en_US_UTF_8);
+    }
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.operators/compare.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.operators/compare.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.operators/compare.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.operators/compare.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class charT, class Traits, class Allocator>
+//   bool operator()(const basic_string<charT,Traits,Allocator>& s1,
+//                   const basic_string<charT,Traits,Allocator>& s2) const;
+
+#include <locale>
+#include <cassert>
+
+int main()
+{
+    {
+        std::locale l;
+        {
+            std::string s2("aaaaaaA");
+            std::string s3("BaaaaaA");
+            assert(l(s3, s2));
+        }
+        {
+            std::wstring s2(L"aaaaaaA");
+            std::wstring s3(L"BaaaaaA");
+            assert(l(s3, s2));
+        }
+    }
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.operators/eq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.operators/eq.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.operators/eq.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.operators/eq.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// basic_string<char> name() const;
+
+#include <locale>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+int main()
+{
+    std::locale cloc;
+    std::locale copy(cloc);
+    std::locale n1(LOCALE_en_US_UTF_8);
+    std::locale n2(LOCALE_en_US_UTF_8);
+    std::locale noname1 = n1.combine<std::ctype<char> >(cloc);
+    std::locale nonamec = noname1;
+    std::locale noname2 = n1.combine<std::ctype<char> >(cloc);
+
+    assert(cloc == cloc);
+    assert(cloc == copy);
+    assert(cloc != n1);
+    assert(cloc != n2);
+    assert(cloc != noname1);
+    assert(cloc != nonamec);
+    assert(cloc != noname2);
+
+    assert(copy == cloc);
+    assert(copy == copy);
+    assert(copy != n1);
+    assert(copy != n2);
+    assert(copy != noname1);
+    assert(copy != nonamec);
+    assert(copy != noname2);
+
+    assert(n1 != cloc);
+    assert(n1 != copy);
+    assert(n1 == n1);
+    assert(n1 == n2);
+    assert(n1 != noname1);
+    assert(n1 != nonamec);
+    assert(n1 != noname2);
+
+    assert(n2 != cloc);
+    assert(n2 != copy);
+    assert(n2 == n1);
+    assert(n2 == n2);
+    assert(n2 != noname1);
+    assert(n2 != nonamec);
+    assert(n2 != noname2);
+
+    assert(noname1 != cloc);
+    assert(noname1 != copy);
+    assert(noname1 != n1);
+    assert(noname1 != n2);
+    assert(noname1 == noname1);
+    assert(noname1 == nonamec);
+    assert(noname1 != noname2);
+
+    assert(nonamec != cloc);
+    assert(nonamec != copy);
+    assert(nonamec != n1);
+    assert(nonamec != n2);
+    assert(nonamec == noname1);
+    assert(nonamec == nonamec);
+    assert(nonamec != noname2);
+
+    assert(noname2 != cloc);
+    assert(noname2 != copy);
+    assert(noname2 != n1);
+    assert(noname2 != n2);
+    assert(noname2 != noname1);
+    assert(noname2 != nonamec);
+    assert(noname2 == noname2);
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.statics/classic.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.statics/classic.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.statics/classic.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.statics/classic.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// static const locale& classic();
+
+#include <locale>
+#include <cassert>
+
+void check(const std::locale& loc)
+{
+    assert(std::has_facet<std::collate<char> >(loc));
+    assert(std::has_facet<std::collate<wchar_t> >(loc));
+
+    assert(std::has_facet<std::ctype<char> >(loc));
+    assert(std::has_facet<std::ctype<wchar_t> >(loc));
+    assert((std::has_facet<std::codecvt<char, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char16_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char32_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(loc)));
+
+    assert((std::has_facet<std::moneypunct<char> >(loc)));
+    assert((std::has_facet<std::moneypunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_get<char> >(loc)));
+    assert((std::has_facet<std::money_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_put<char> >(loc)));
+    assert((std::has_facet<std::money_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::numpunct<char> >(loc)));
+    assert((std::has_facet<std::numpunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_get<char> >(loc)));
+    assert((std::has_facet<std::num_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_put<char> >(loc)));
+    assert((std::has_facet<std::num_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::time_get<char> >(loc)));
+    assert((std::has_facet<std::time_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::time_put<char> >(loc)));
+    assert((std::has_facet<std::time_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::messages<char> >(loc)));
+    assert((std::has_facet<std::messages<wchar_t> >(loc)));
+}
+
+int main()
+{
+    std::locale loc = std::locale::classic();
+    assert(loc.name() == "C");
+    assert(loc == std::locale("C"));
+    check(loc);
+    check(std::locale("C"));
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.statics/global.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.statics/global.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.statics/global.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.statics/global.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// static const locale& classic();
+
+#include <locale>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+void check(const std::locale& loc)
+{
+    assert(std::has_facet<std::collate<char> >(loc));
+    assert(std::has_facet<std::collate<wchar_t> >(loc));
+
+    assert(std::has_facet<std::ctype<char> >(loc));
+    assert(std::has_facet<std::ctype<wchar_t> >(loc));
+    assert((std::has_facet<std::codecvt<char, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char16_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<char32_t, char, std::mbstate_t> >(loc)));
+    assert((std::has_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(loc)));
+
+    assert((std::has_facet<std::moneypunct<char> >(loc)));
+    assert((std::has_facet<std::moneypunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_get<char> >(loc)));
+    assert((std::has_facet<std::money_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::money_put<char> >(loc)));
+    assert((std::has_facet<std::money_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::numpunct<char> >(loc)));
+    assert((std::has_facet<std::numpunct<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_get<char> >(loc)));
+    assert((std::has_facet<std::num_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::num_put<char> >(loc)));
+    assert((std::has_facet<std::num_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::time_get<char> >(loc)));
+    assert((std::has_facet<std::time_get<wchar_t> >(loc)));
+    assert((std::has_facet<std::time_put<char> >(loc)));
+    assert((std::has_facet<std::time_put<wchar_t> >(loc)));
+
+    assert((std::has_facet<std::messages<char> >(loc)));
+    assert((std::has_facet<std::messages<wchar_t> >(loc)));
+}
+
+int main()
+{
+    std::locale loc;
+    assert(loc.name() == "C");
+    check(loc);
+    assert(std::locale::global(std::locale(LOCALE_en_US_UTF_8)) == loc);
+    std::locale loc2;
+    check(loc2);
+    assert(loc2 == std::locale(LOCALE_en_US_UTF_8));
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This test uses new symbols that were not defined in the libc++ shipped on
+// darwin11 and darwin12:
+// XFAIL: with_system_lib=x86_64-apple-darwin11
+// XFAIL: with_system_lib=x86_64-apple-darwin12
+
+// <locale>
+
+// typedef int category;
+
+#include <locale>
+#include <type_traits>
+#include <cassert>
+
+template <class _Tp>
+void test(const _Tp &) {}
+
+
+int main()
+{
+    static_assert((std::is_same<std::locale::category, int>::value), "");
+    assert(std::locale::none == 0);
+    assert(std::locale::collate);
+    assert(std::locale::ctype);
+    assert(std::locale::monetary);
+    assert(std::locale::numeric);
+    assert(std::locale::time);
+    assert(std::locale::messages);
+    assert((std::locale::collate
+          & std::locale::ctype
+          & std::locale::monetary
+          & std::locale::numeric
+          & std::locale::time
+          & std::locale::messages) == 0);
+    assert((std::locale::collate
+          | std::locale::ctype
+          | std::locale::monetary
+          | std::locale::numeric
+          | std::locale::time
+          | std::locale::messages)
+         == std::locale::all);
+
+    test(std::locale::none);
+    test(std::locale::collate);
+    test(std::locale::ctype);
+    test(std::locale::monetary);
+    test(std::locale::numeric);
+    test(std::locale::time);
+    test(std::locale::messages);
+    test(std::locale::all);
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class locale::facet
+// {
+// protected:
+//     explicit facet(size_t refs = 0);
+//     virtual ~facet();
+//     facet(const facet&) = delete;
+//     void operator=(const facet&) = delete;
+// };
+
+// This test isn't portable
+
+#include <locale>
+#include <cassert>
+
+struct my_facet
+    : public std::locale::facet
+{
+    static int count;
+    my_facet(unsigned refs = 0)
+        : std::locale::facet(refs)
+        {++count;}
+
+    ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main()
+{
+    my_facet* f = new my_facet;
+    f->__add_shared();
+    assert(my_facet::count == 1);
+    f->__release_shared();
+    assert(my_facet::count == 0);
+    f = new my_facet(1);
+    f->__add_shared();
+    assert(my_facet::count == 1);
+    f->__release_shared();
+    assert(my_facet::count == 1);
+    f->__release_shared();
+    assert(my_facet::count == 0);
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.types/locale.id/id.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.types/locale.id/id.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.types/locale.id/id.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.types/locale.id/id.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class locale::id
+// {
+// public:
+//     id();
+//     void operator=(const id&) = delete;
+//     id(const id&) = delete;
+// };
+
+// This test isn't portable
+
+#include <locale>
+#include <cassert>
+
+std::locale::id id0;
+std::locale::id id2;
+std::locale::id id1;
+
+int main()
+{
+    long id = id0.__get();
+    assert(id0.__get() == id+0);
+    assert(id0.__get() == id+0);
+    assert(id0.__get() == id+0);
+    assert(id1.__get() == id+1);
+    assert(id1.__get() == id+1);
+    assert(id1.__get() == id+1);
+    assert(id2.__get() == id+2);
+    assert(id2.__get() == id+2);
+    assert(id2.__get() == id+2);
+    assert(id0.__get() == id+0);
+    assert(id0.__get() == id+0);
+    assert(id0.__get() == id+0);
+    assert(id1.__get() == id+1);
+    assert(id1.__get() == id+1);
+    assert(id1.__get() == id+1);
+    assert(id2.__get() == id+2);
+    assert(id2.__get() == id+2);
+    assert(id2.__get() == id+2);
+}

Added: libcxx/trunk/test/std/localization/locales/locale/locale.types/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/locale.types/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/locale.types/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/locale.types/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locales/locale/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/locale/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/locale/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/locales/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/locales/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/locales/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/localization.general/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/localization.general/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/localization.general/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/localization.general/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/localization/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/localization/version.pass.cpp (added)
+++ libcxx/trunk/test/std/localization/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+#include <locale>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/numerics/c.math/cmath.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/c.math/cmath.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/c.math/cmath.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/c.math/cmath.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,1485 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <cmath>
+
+// NOTE: isinf and isnan are tested separately because they are expected to fail
+// on linux. We don't want their expected failure to hide other failures in this file.
+
+#include <cmath>
+#include <type_traits>
+#include <cassert>
+
+#include "hexfloat.h"
+
+// convertible to int/float/double/etc
+template <class T, int N=0>
+struct Value {
+    operator T () { return T(N); }
+};
+
+// See PR21083
+// Ambiguous is a user-defined type that defines its own overloads of cmath
+// functions. When the std overloads are candidates too (by using or adl),
+// they should not interfere.
+struct Ambiguous : std::true_type { // ADL
+    operator float () { return 0.f; }
+    operator double () { return 0.; }
+};
+Ambiguous abs(Ambiguous){ return Ambiguous(); }
+Ambiguous acos(Ambiguous){ return Ambiguous(); }
+Ambiguous asin(Ambiguous){ return Ambiguous(); }
+Ambiguous atan(Ambiguous){ return Ambiguous(); }
+Ambiguous atan2(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous ceil(Ambiguous){ return Ambiguous(); }
+Ambiguous cos(Ambiguous){ return Ambiguous(); }
+Ambiguous cosh(Ambiguous){ return Ambiguous(); }
+Ambiguous exp(Ambiguous){ return Ambiguous(); }
+Ambiguous fabs(Ambiguous){ return Ambiguous(); }
+Ambiguous floor(Ambiguous){ return Ambiguous(); }
+Ambiguous fmod(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous frexp(Ambiguous, int*){ return Ambiguous(); }
+Ambiguous ldexp(Ambiguous, int){ return Ambiguous(); }
+Ambiguous log(Ambiguous){ return Ambiguous(); }
+Ambiguous log10(Ambiguous){ return Ambiguous(); }
+Ambiguous modf(Ambiguous, Ambiguous*){ return Ambiguous(); }
+Ambiguous pow(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous sin(Ambiguous){ return Ambiguous(); }
+Ambiguous sinh(Ambiguous){ return Ambiguous(); }
+Ambiguous sqrt(Ambiguous){ return Ambiguous(); }
+Ambiguous tan(Ambiguous){ return Ambiguous(); }
+Ambiguous tanh(Ambiguous){ return Ambiguous(); }
+Ambiguous signbit(Ambiguous){ return Ambiguous(); }
+Ambiguous fpclassify(Ambiguous){ return Ambiguous(); }
+Ambiguous isfinite(Ambiguous){ return Ambiguous(); }
+Ambiguous isnormal(Ambiguous){ return Ambiguous(); }
+Ambiguous isgreater(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous isgreaterequal(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous isless(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous islessequal(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous islessgreater(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous isunordered(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous acosh(Ambiguous){ return Ambiguous(); }
+Ambiguous asinh(Ambiguous){ return Ambiguous(); }
+Ambiguous atanh(Ambiguous){ return Ambiguous(); }
+Ambiguous cbrt(Ambiguous){ return Ambiguous(); }
+Ambiguous copysign(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous erf(Ambiguous){ return Ambiguous(); }
+Ambiguous erfc(Ambiguous){ return Ambiguous(); }
+Ambiguous exp2(Ambiguous){ return Ambiguous(); }
+Ambiguous expm1(Ambiguous){ return Ambiguous(); }
+Ambiguous fdim(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous fma(Ambiguous, Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous fmax(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous fmin(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous hypot(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous ilogb(Ambiguous){ return Ambiguous(); }
+Ambiguous lgamma(Ambiguous){ return Ambiguous(); }
+Ambiguous llrint(Ambiguous){ return Ambiguous(); }
+Ambiguous llround(Ambiguous){ return Ambiguous(); }
+Ambiguous log1p(Ambiguous){ return Ambiguous(); }
+Ambiguous log2(Ambiguous){ return Ambiguous(); }
+Ambiguous logb(Ambiguous){ return Ambiguous(); }
+Ambiguous lrint(Ambiguous){ return Ambiguous(); }
+Ambiguous lround(Ambiguous){ return Ambiguous(); }
+Ambiguous nearbyint(Ambiguous){ return Ambiguous(); }
+Ambiguous nextafter(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous nexttoward(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous remainder(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous remquo(Ambiguous, Ambiguous, int*){ return Ambiguous(); }
+Ambiguous rint(Ambiguous){ return Ambiguous(); }
+Ambiguous round(Ambiguous){ return Ambiguous(); }
+Ambiguous scalbln(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous scalbn(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous tgamma(Ambiguous){ return Ambiguous(); }
+Ambiguous trunc(Ambiguous){ return Ambiguous(); }
+
+void test_abs()
+{
+    static_assert((std::is_same<decltype(std::abs((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::abs((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::abs((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(abs(Ambiguous())), Ambiguous>::value), "");
+    assert(std::abs(-1.) == 1);
+}
+
+void test_acos()
+{
+    static_assert((std::is_same<decltype(std::acos((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::acos((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acos((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acos((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acos((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acos((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acos((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acos((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acos((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acos((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acos((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::acosf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::acosl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(acos(Ambiguous())), Ambiguous>::value), "");
+    assert(std::acos(1) == 0);
+}
+
+void test_asin()
+{
+    static_assert((std::is_same<decltype(std::asin((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::asin((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asin((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asin((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asin((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asin((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asin((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asin((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asin((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asin((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asin((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::asinf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::asinl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(asin(Ambiguous())), Ambiguous>::value), "");
+    assert(std::asin(0) == 0);
+}
+
+void test_atan()
+{
+    static_assert((std::is_same<decltype(std::atan((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::atan((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::atanf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::atanl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(atan(Ambiguous())), Ambiguous>::value), "");
+    assert(std::atan(0) == 0);
+}
+
+void test_atan2()
+{
+    static_assert((std::is_same<decltype(std::atan2((float)0, (float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::atan2((bool)0, (float)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan2((unsigned short)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan2((int)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::atan2((float)0, (unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan2((double)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan2((long double)0, (unsigned long)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::atan2((int)0, (long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan2((int)0, (unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan2((double)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan2((long double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::atan2((float)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atan2((float)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::atan2((double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::atan2f(0,0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::atan2l(0,0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::atan2((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(atan2(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::atan2(0,1) == 0);
+}
+
+void test_ceil()
+{
+    static_assert((std::is_same<decltype(std::ceil((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::ceil((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ceil((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ceil((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ceil((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ceil((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ceil((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ceil((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ceil((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ceil((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ceil((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::ceilf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::ceill(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(ceil(Ambiguous())), Ambiguous>::value), "");
+    assert(std::ceil(0) == 0);
+}
+
+void test_cos()
+{
+    static_assert((std::is_same<decltype(std::cos((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::cos((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cos((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cos((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cos((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cos((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cos((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cos((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cos((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cos((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cos((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::cosf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::cosl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(cos(Ambiguous())), Ambiguous>::value), "");
+    assert(std::cos(0) == 1);
+}
+
+void test_cosh()
+{
+    static_assert((std::is_same<decltype(std::cosh((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::cosh((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cosh((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cosh((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cosh((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cosh((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cosh((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cosh((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cosh((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cosh((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cosh((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::coshf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::coshl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(cosh(Ambiguous())), Ambiguous>::value), "");
+    assert(std::cosh(0) == 1);
+}
+
+void test_exp()
+{
+    static_assert((std::is_same<decltype(std::exp((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::exp((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::expf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::expl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(exp(Ambiguous())), Ambiguous>::value), "");
+    assert(std::exp(0) == 1);
+}
+
+void test_fabs()
+{
+    static_assert((std::is_same<decltype(std::fabs((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::fabs((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fabs((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fabs((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fabs((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fabs((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fabs((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fabs((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fabs((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fabs((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fabs((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fabsf(0.0f)), float>::value), "");
+    static_assert((std::is_same<decltype(std::fabsl(0.0L)), long double>::value), "");
+    static_assert((std::is_same<decltype(fabs(Ambiguous())), Ambiguous>::value), "");
+    assert(std::fabs(-1) == 1);
+}
+
+void test_floor()
+{
+    static_assert((std::is_same<decltype(std::floor((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::floor((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::floor((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::floor((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::floor((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::floor((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::floor((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::floor((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::floor((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::floor((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::floor((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::floorf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::floorl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(floor(Ambiguous())), Ambiguous>::value), "");
+    assert(std::floor(1) == 1);
+}
+
+void test_fmod()
+{
+    static_assert((std::is_same<decltype(std::fmod((float)0, (float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::fmod((bool)0, (float)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmod((unsigned short)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmod((int)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmod((float)0, (unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmod((double)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmod((long double)0, (unsigned long)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmod((int)0, (long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmod((int)0, (unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmod((double)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmod((long double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmod((float)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmod((float)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmod((double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmodf(0,0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::fmodl(0,0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmod((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(fmod(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::fmod(1.5,1) == .5);
+}
+
+void test_frexp()
+{
+    int ip;
+    static_assert((std::is_same<decltype(std::frexp((float)0, &ip)), float>::value), "");
+    static_assert((std::is_same<decltype(std::frexp((bool)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::frexp((unsigned short)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::frexp((int)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::frexp((unsigned int)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::frexp((long)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::frexp((unsigned long)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::frexp((long long)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::frexp((unsigned long long)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::frexp((double)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::frexp((long double)0, &ip)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::frexpf(0, &ip)), float>::value), "");
+    static_assert((std::is_same<decltype(std::frexpl(0, &ip)), long double>::value), "");
+    static_assert((std::is_same<decltype(frexp(Ambiguous(), &ip)), Ambiguous>::value), "");
+    assert(std::frexp(0, &ip) == 0);
+}
+
+void test_ldexp()
+{
+    int ip = 1;
+    static_assert((std::is_same<decltype(std::ldexp((float)0, ip)), float>::value), "");
+    static_assert((std::is_same<decltype(std::ldexp((bool)0, ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ldexp((unsigned short)0, ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ldexp((int)0, ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ldexp((unsigned int)0, ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ldexp((long)0, ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ldexp((unsigned long)0, ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ldexp((long long)0, ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ldexp((unsigned long long)0, ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ldexp((double)0, ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::ldexp((long double)0, ip)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::ldexpf(0, ip)), float>::value), "");
+    static_assert((std::is_same<decltype(std::ldexpl(0, ip)), long double>::value), "");
+    static_assert((std::is_same<decltype(ldexp(Ambiguous(), ip)), Ambiguous>::value), "");
+    assert(std::ldexp(1, ip) == 2);
+}
+
+void test_log()
+{
+    static_assert((std::is_same<decltype(std::log((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::log((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::logf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::logl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(log(Ambiguous())), Ambiguous>::value), "");
+    assert(std::log(1) == 0);
+}
+
+void test_log10()
+{
+    static_assert((std::is_same<decltype(std::log10((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::log10((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log10((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log10((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log10((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log10((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log10((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log10((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log10((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log10((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log10((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::log10f(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::log10l(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(log10(Ambiguous())), Ambiguous>::value), "");
+    assert(std::log10(1) == 0);
+}
+
+void test_modf()
+{
+    static_assert((std::is_same<decltype(std::modf((float)0, (float*)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::modf((double)0, (double*)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::modf((long double)0, (long double*)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::modff(0, (float*)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::modfl(0, (long double*)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(modf(Ambiguous(), (Ambiguous*)0)), Ambiguous>::value), "");
+    double i;
+    assert(std::modf(1., &i) == 0);
+}
+
+void test_pow()
+{
+    static_assert((std::is_same<decltype(std::pow((float)0, (float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::pow((bool)0, (float)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::pow((unsigned short)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::pow((int)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::pow((float)0, (unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::pow((double)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::pow((long double)0, (unsigned long)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::pow((int)0, (long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::pow((int)0, (unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::pow((double)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::pow((long double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::pow((float)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::pow((float)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::pow((double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::powf(0,0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::powl(0,0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::pow((int)0, (int)0)), double>::value), "");
+//     static_assert((std::is_same<decltype(std::pow(Value<int>(), (int)0)), double>::value), "");
+//     static_assert((std::is_same<decltype(std::pow(Value<long double>(), (float)0)), long double>::value), "");
+//     static_assert((std::is_same<decltype(std::pow((float) 0, Value<float>())), float>::value), "");
+    static_assert((std::is_same<decltype(pow(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::pow(1,1) == 1);
+//     assert(std::pow(Value<int,1>(), Value<float,1>())  == 1);
+//     assert(std::pow(1.0f, Value<double,1>()) == 1);
+//     assert(std::pow(1.0, Value<int,1>()) == 1);
+//     assert(std::pow(Value<long double,1>(), 1LL) == 1);
+}
+
+void test_sin()
+{
+    static_assert((std::is_same<decltype(std::sin((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::sin((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sin((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sin((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sin((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sin((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sin((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sin((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sin((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sin((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sin((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::sinf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::sinl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(sin(Ambiguous())), Ambiguous>::value), "");
+    assert(std::sin(0) == 0);
+}
+
+void test_sinh()
+{
+    static_assert((std::is_same<decltype(std::sinh((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::sinh((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sinh((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sinh((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sinh((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sinh((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sinh((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sinh((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sinh((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sinh((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sinh((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::sinhf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::sinhl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(sinh(Ambiguous())), Ambiguous>::value), "");
+    assert(std::sinh(0) == 0);
+}
+
+void test_sqrt()
+{
+    static_assert((std::is_same<decltype(std::sqrt((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::sqrt((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sqrt((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sqrt((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sqrt((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sqrt((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sqrt((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sqrt((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sqrt((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sqrt((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::sqrt((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::sqrtf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::sqrtl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(sqrt(Ambiguous())), Ambiguous>::value), "");
+    assert(std::sqrt(4) == 2);
+}
+
+void test_tan()
+{
+    static_assert((std::is_same<decltype(std::tan((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::tan((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tan((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tan((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tan((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tan((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tan((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tan((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tan((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tan((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tan((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::tanf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::tanl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(tan(Ambiguous())), Ambiguous>::value), "");
+    assert(std::tan(0) == 0);
+}
+
+void test_tanh()
+{
+    static_assert((std::is_same<decltype(std::tanh((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::tanh((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tanh((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tanh((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tanh((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tanh((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tanh((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tanh((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tanh((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tanh((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tanh((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::tanhf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::tanhl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(tanh(Ambiguous())), Ambiguous>::value), "");
+    assert(std::tanh(0) == 0);
+}
+
+void test_signbit()
+{
+#ifdef signbit
+#error signbit defined
+#endif
+    static_assert((std::is_same<decltype(std::signbit((float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::signbit((double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::signbit(0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::signbit((long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(signbit(Ambiguous())), Ambiguous>::value), "");
+    assert(std::signbit(-1.0) == true);
+}
+
+void test_fpclassify()
+{
+#ifdef fpclassify
+#error fpclassify defined
+#endif
+    static_assert((std::is_same<decltype(std::fpclassify((float)0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fpclassify((double)0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fpclassify(0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fpclassify((long double)0)), int>::value), "");
+    static_assert((std::is_same<decltype(fpclassify(Ambiguous())), Ambiguous>::value), "");
+    assert(std::fpclassify(-1.0) == FP_NORMAL);
+}
+
+void test_isfinite()
+{
+#ifdef isfinite
+#error isfinite defined
+#endif
+    static_assert((std::is_same<decltype(std::isfinite((float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isfinite((double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isfinite(0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isfinite((long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isfinite(Ambiguous())), Ambiguous>::value), "");
+    assert(std::isfinite(-1.0) == true);
+}
+
+void test_isnormal()
+{
+#ifdef isnormal
+#error isnormal defined
+#endif
+    static_assert((std::is_same<decltype(std::isnormal((float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isnormal((double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isnormal(0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isnormal((long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isnormal(Ambiguous())), Ambiguous>::value), "");
+    assert(std::isnormal(-1.0) == true);
+}
+
+void test_isgreater()
+{
+#ifdef isgreater
+#error isgreater defined
+#endif
+    static_assert((std::is_same<decltype(std::isgreater((float)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreater((float)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreater((float)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreater((double)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreater((double)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreater(0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreater((double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreater((long double)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreater((long double)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreater((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isgreater(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::isgreater(-1.0, 0.F) == false);
+}
+
+void test_isgreaterequal()
+{
+#ifdef isgreaterequal
+#error isgreaterequal defined
+#endif
+    static_assert((std::is_same<decltype(std::isgreaterequal((float)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreaterequal((float)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreaterequal((float)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreaterequal((double)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreaterequal((double)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreaterequal(0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreaterequal((double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreaterequal((long double)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreaterequal((long double)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isgreaterequal((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isgreaterequal(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::isgreaterequal(-1.0, 0.F) == false);
+}
+
+void test_isless()
+{
+#ifdef isless
+#error isless defined
+#endif
+    static_assert((std::is_same<decltype(std::isless((float)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isless((float)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isless((float)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isless((double)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isless((double)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isless(0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isless((double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isless((long double)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isless((long double)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isless((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isless(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::isless(-1.0, 0.F) == true);
+}
+
+void test_islessequal()
+{
+#ifdef islessequal
+#error islessequal defined
+#endif
+    static_assert((std::is_same<decltype(std::islessequal((float)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessequal((float)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessequal((float)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessequal((double)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessequal((double)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessequal(0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessequal((double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessequal((long double)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessequal((long double)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessequal((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(islessequal(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::islessequal(-1.0, 0.F) == true);
+}
+
+void test_islessgreater()
+{
+#ifdef islessgreater
+#error islessgreater defined
+#endif
+    static_assert((std::is_same<decltype(std::islessgreater((float)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessgreater((float)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessgreater((float)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessgreater((double)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessgreater((double)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessgreater(0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessgreater((double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessgreater((long double)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessgreater((long double)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::islessgreater((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(islessgreater(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::islessgreater(-1.0, 0.F) == true);
+}
+
+void test_isunordered()
+{
+#ifdef isunordered
+#error isunordered defined
+#endif
+    static_assert((std::is_same<decltype(std::isunordered((float)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isunordered((float)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isunordered((float)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isunordered((double)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isunordered((double)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isunordered(0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isunordered((double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isunordered((long double)0, (float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isunordered((long double)0, (double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isunordered((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isunordered(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::isunordered(-1.0, 0.F) == false);
+}
+
+void test_acosh()
+{
+    static_assert((std::is_same<decltype(std::acosh((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::acosh((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acosh((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acosh((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acosh((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acosh((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acosh((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acosh((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acosh((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acosh((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::acosh((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::acoshf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::acoshl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(acosh(Ambiguous())), Ambiguous>::value), "");
+    assert(std::acosh(1) == 0);
+}
+
+void test_asinh()
+{
+    static_assert((std::is_same<decltype(std::asinh((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::asinh((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asinh((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asinh((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asinh((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asinh((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asinh((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asinh((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asinh((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asinh((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::asinh((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::asinhf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::asinhl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(asinh(Ambiguous())), Ambiguous>::value), "");
+    assert(std::asinh(0) == 0);
+}
+
+void test_atanh()
+{
+    static_assert((std::is_same<decltype(std::atanh((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::atanh((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atanh((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atanh((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atanh((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atanh((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atanh((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atanh((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atanh((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atanh((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::atanh((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::atanhf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::atanhl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(atanh(Ambiguous())), Ambiguous>::value), "");
+    assert(std::atanh(0) == 0);
+}
+
+void test_cbrt()
+{
+    static_assert((std::is_same<decltype(std::cbrt((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::cbrt((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cbrt((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cbrt((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cbrt((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cbrt((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cbrt((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cbrt((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cbrt((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cbrt((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::cbrt((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::cbrtf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::cbrtl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(cbrt(Ambiguous())), Ambiguous>::value), "");
+    assert(std::cbrt(1) == 1);
+}
+
+void test_copysign()
+{
+    static_assert((std::is_same<decltype(std::copysign((float)0, (float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::copysign((bool)0, (float)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::copysign((unsigned short)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::copysign((int)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::copysign((float)0, (unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::copysign((double)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::copysign((long double)0, (unsigned long)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::copysign((int)0, (long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::copysign((int)0, (unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::copysign((double)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::copysign((long double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::copysign((float)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::copysign((float)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::copysign((double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::copysignf(0,0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::copysignl(0,0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::copysign((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(copysign(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::copysign(1,1) == 1);
+}
+
+void test_erf()
+{
+    static_assert((std::is_same<decltype(std::erf((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::erf((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erf((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erf((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erf((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erf((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erf((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erf((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erf((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erf((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erf((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::erff(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::erfl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(erf(Ambiguous())), Ambiguous>::value), "");
+    assert(std::erf(0) == 0);
+}
+
+void test_erfc()
+{
+    static_assert((std::is_same<decltype(std::erfc((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::erfc((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erfc((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erfc((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erfc((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erfc((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erfc((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erfc((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erfc((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erfc((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::erfc((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::erfcf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::erfcl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(erfc(Ambiguous())), Ambiguous>::value), "");
+    assert(std::erfc(0) == 1);
+}
+
+void test_exp2()
+{
+    static_assert((std::is_same<decltype(std::exp2((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::exp2((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp2((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp2((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp2((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp2((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp2((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp2((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp2((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp2((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::exp2((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::exp2f(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::exp2l(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(exp2(Ambiguous())), Ambiguous>::value), "");
+    assert(std::exp2(1) == 2);
+}
+
+void test_expm1()
+{
+    static_assert((std::is_same<decltype(std::expm1((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::expm1((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::expm1((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::expm1((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::expm1((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::expm1((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::expm1((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::expm1((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::expm1((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::expm1((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::expm1((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::expm1f(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::expm1l(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(expm1(Ambiguous())), Ambiguous>::value), "");
+    assert(std::expm1(0) == 0);
+}
+
+void test_fdim()
+{
+    static_assert((std::is_same<decltype(std::fdim((float)0, (float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::fdim((bool)0, (float)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fdim((unsigned short)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fdim((int)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fdim((float)0, (unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fdim((double)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fdim((long double)0, (unsigned long)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fdim((int)0, (long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fdim((int)0, (unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fdim((double)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fdim((long double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fdim((float)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fdim((float)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fdim((double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fdimf(0,0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::fdiml(0,0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fdim((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(fdim(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::fdim(1,0) == 1);
+}
+
+void test_fma()
+{
+    static_assert((std::is_same<decltype(std::fma((bool)0, (float)0, (float)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((char)0, (float)0, (float)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((unsigned)0, (float)0, (float)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((float)0, (int)0, (float)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((float)0, (long)0, (float)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((float)0, (float)0, (unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((float)0, (float)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((float)0, (float)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((float)0, (float)0, (float)0)), float>::value), "");
+
+    static_assert((std::is_same<decltype(std::fma((bool)0, (double)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((char)0, (double)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((unsigned)0, (double)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((double)0, (int)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((double)0, (long)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((double)0, (double)0, (unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((double)0, (double)0, (float)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((double)0, (double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((double)0, (double)0,  (double)0)), double>::value), "");
+
+    static_assert((std::is_same<decltype(std::fma((bool)0, (long double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((char)0, (long double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((unsigned)0, (long double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((long double)0, (int)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((long double)0, (long)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((long double)0, (long double)0, (unsigned long long)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((long double)0, (long double)0, (float)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((double)0, (long double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fma((long double)0, (long double)0, (long double)0)), long double>::value), "");
+
+    static_assert((std::is_same<decltype(std::fmaf(0,0,0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::fmal(0,0,0)), long double>::value), "");
+    static_assert((std::is_same<decltype(fma(Ambiguous(), Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::fma(1,1,1) == 2);
+}
+
+void test_fmax()
+{
+    static_assert((std::is_same<decltype(std::fmax((float)0, (float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::fmax((bool)0, (float)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmax((unsigned short)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmax((int)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmax((float)0, (unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmax((double)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmax((long double)0, (unsigned long)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmax((int)0, (long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmax((int)0, (unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmax((double)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmax((long double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmax((float)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmax((float)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmax((double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmaxf(0,0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::fmaxl(0,0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmax((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(fmax(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::fmax(1,0) == 1);
+}
+
+void test_fmin()
+{
+    static_assert((std::is_same<decltype(std::fmin((float)0, (float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::fmin((bool)0, (float)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmin((unsigned short)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmin((int)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmin((float)0, (unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmin((double)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmin((long double)0, (unsigned long)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmin((int)0, (long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmin((int)0, (unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmin((double)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmin((long double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmin((float)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::fmin((float)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmin((double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fminf(0,0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::fminl(0,0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::fmin((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(fmin(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::fmin(1,0) == 0);
+}
+
+void test_hypot()
+{
+    static_assert((std::is_same<decltype(std::hypot((float)0, (float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::hypot((bool)0, (float)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::hypot((unsigned short)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::hypot((int)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::hypot((float)0, (unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::hypot((double)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::hypot((long double)0, (unsigned long)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::hypot((int)0, (long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::hypot((int)0, (unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::hypot((double)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::hypot((long double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::hypot((float)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::hypot((float)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::hypot((double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::hypotf(0,0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::hypotl(0,0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::hypot((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(hypot(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::hypot(3,4) == 5);
+}
+
+void test_ilogb()
+{
+    static_assert((std::is_same<decltype(std::ilogb((float)0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::ilogb((bool)0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::ilogb((unsigned short)0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::ilogb((int)0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::ilogb((unsigned int)0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::ilogb((long)0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::ilogb((unsigned long)0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::ilogb((long long)0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::ilogb((unsigned long long)0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::ilogb((double)0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::ilogb((long double)0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::ilogbf(0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::ilogbl(0)), int>::value), "");
+    static_assert((std::is_same<decltype(ilogb(Ambiguous())), Ambiguous>::value), "");
+    assert(std::ilogb(1) == 0);
+}
+
+void test_lgamma()
+{
+    static_assert((std::is_same<decltype(std::lgamma((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::lgamma((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::lgamma((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::lgamma((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::lgamma((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::lgamma((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::lgamma((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::lgamma((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::lgamma((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::lgamma((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::lgamma((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::lgammaf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::lgammal(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(lgamma(Ambiguous())), Ambiguous>::value), "");
+    assert(std::lgamma(1) == 0);
+}
+
+void test_llrint()
+{
+    static_assert((std::is_same<decltype(std::llrint((float)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llrint((bool)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llrint((unsigned short)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llrint((int)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llrint((unsigned int)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llrint((long)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llrint((unsigned long)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llrint((long long)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llrint((unsigned long long)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llrint((double)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llrint((long double)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llrintf(0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llrintl(0)), long long>::value), "");
+    static_assert((std::is_same<decltype(llrint(Ambiguous())), Ambiguous>::value), "");
+    assert(std::llrint(1) == 1LL);
+}
+
+void test_llround()
+{
+    static_assert((std::is_same<decltype(std::llround((float)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llround((bool)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llround((unsigned short)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llround((int)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llround((unsigned int)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llround((long)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llround((unsigned long)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llround((long long)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llround((unsigned long long)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llround((double)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llround((long double)0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llroundf(0)), long long>::value), "");
+    static_assert((std::is_same<decltype(std::llroundl(0)), long long>::value), "");
+    static_assert((std::is_same<decltype(llround(Ambiguous())), Ambiguous>::value), "");
+    assert(std::llround(1) == 1LL);
+}
+
+void test_log1p()
+{
+    static_assert((std::is_same<decltype(std::log1p((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::log1p((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log1p((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log1p((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log1p((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log1p((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log1p((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log1p((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log1p((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log1p((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log1p((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::log1pf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::log1pl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(log1p(Ambiguous())), Ambiguous>::value), "");
+    assert(std::log1p(0) == 0);
+}
+
+void test_log2()
+{
+    static_assert((std::is_same<decltype(std::log2((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::log2((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log2((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log2((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log2((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log2((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log2((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log2((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log2((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log2((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::log2((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::log2f(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::log2l(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(log2(Ambiguous())), Ambiguous>::value), "");
+    assert(std::log2(1) == 0);
+}
+
+void test_logb()
+{
+    static_assert((std::is_same<decltype(std::logb((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::logb((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::logb((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::logb((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::logb((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::logb((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::logb((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::logb((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::logb((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::logb((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::logb((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::logbf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::logbl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(logb(Ambiguous())), Ambiguous>::value), "");
+    assert(std::logb(1) == 0);
+}
+
+void test_lrint()
+{
+    static_assert((std::is_same<decltype(std::lrint((float)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lrint((bool)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lrint((unsigned short)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lrint((int)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lrint((unsigned int)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lrint((long)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lrint((unsigned long)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lrint((long long)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lrint((unsigned long long)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lrint((double)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lrint((long double)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lrintf(0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lrintl(0)), long>::value), "");
+    static_assert((std::is_same<decltype(lrint(Ambiguous())), Ambiguous>::value), "");
+    assert(std::lrint(1) == 1L);
+}
+
+void test_lround()
+{
+    static_assert((std::is_same<decltype(std::lround((float)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lround((bool)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lround((unsigned short)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lround((int)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lround((unsigned int)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lround((long)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lround((unsigned long)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lround((long long)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lround((unsigned long long)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lround((double)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lround((long double)0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lroundf(0)), long>::value), "");
+    static_assert((std::is_same<decltype(std::lroundl(0)), long>::value), "");
+    static_assert((std::is_same<decltype(lround(Ambiguous())), Ambiguous>::value), "");
+    assert(std::lround(1) == 1L);
+}
+
+void test_nan()
+{
+    static_assert((std::is_same<decltype(std::nan("")), double>::value), "");
+    static_assert((std::is_same<decltype(std::nanf("")), float>::value), "");
+    static_assert((std::is_same<decltype(std::nanl("")), long double>::value), "");
+}
+
+void test_nearbyint()
+{
+    static_assert((std::is_same<decltype(std::nearbyint((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::nearbyint((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nearbyint((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nearbyint((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nearbyint((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nearbyint((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nearbyint((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nearbyint((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nearbyint((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nearbyint((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nearbyint((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::nearbyintf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::nearbyintl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(nearbyint(Ambiguous())), Ambiguous>::value), "");
+    assert(std::nearbyint(1) == 1);
+}
+
+void test_nextafter()
+{
+    static_assert((std::is_same<decltype(std::nextafter((float)0, (float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::nextafter((bool)0, (float)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nextafter((unsigned short)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nextafter((int)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::nextafter((float)0, (unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nextafter((double)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nextafter((long double)0, (unsigned long)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::nextafter((int)0, (long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nextafter((int)0, (unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nextafter((double)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nextafter((long double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::nextafter((float)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nextafter((float)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::nextafter((double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::nextafterf(0,0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::nextafterl(0,0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::nextafter((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(nextafter(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::nextafter(0,1) == hexfloat<double>(0x1, 0, -1074));
+}
+
+void test_nexttoward()
+{
+    static_assert((std::is_same<decltype(std::nexttoward((float)0, (long double)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::nexttoward((bool)0, (long double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nexttoward((unsigned short)0, (long double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nexttoward((int)0, (long double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nexttoward((unsigned int)0, (long double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nexttoward((long)0, (long double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nexttoward((unsigned long)0, (long double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nexttoward((long long)0, (long double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nexttoward((unsigned long long)0, (long double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nexttoward((double)0, (long double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::nexttoward((long double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::nexttowardf(0, (long double)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::nexttowardl(0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(nexttoward(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::nexttoward(0, 1) == hexfloat<double>(0x1, 0, -1074));
+}
+
+void test_remainder()
+{
+    static_assert((std::is_same<decltype(std::remainder((float)0, (float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::remainder((bool)0, (float)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::remainder((unsigned short)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::remainder((int)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::remainder((float)0, (unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::remainder((double)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::remainder((long double)0, (unsigned long)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::remainder((int)0, (long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::remainder((int)0, (unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::remainder((double)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::remainder((long double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::remainder((float)0, (double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::remainder((float)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::remainder((double)0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::remainderf(0,0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::remainderl(0,0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::remainder((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(remainder(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::remainder(0.5,1) == 0.5);
+}
+
+void test_remquo()
+{
+    int ip;
+    static_assert((std::is_same<decltype(std::remquo((float)0, (float)0, &ip)), float>::value), "");
+    static_assert((std::is_same<decltype(std::remquo((bool)0, (float)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::remquo((unsigned short)0, (double)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::remquo((int)0, (long double)0, &ip)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::remquo((float)0, (unsigned int)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::remquo((double)0, (long)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::remquo((long double)0, (unsigned long)0, &ip)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::remquo((int)0, (long long)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::remquo((int)0, (unsigned long long)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::remquo((double)0, (double)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::remquo((long double)0, (long double)0, &ip)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::remquo((float)0, (double)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(std::remquo((float)0, (long double)0, &ip)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::remquo((double)0, (long double)0, &ip)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::remquof(0,0, &ip)), float>::value), "");
+    static_assert((std::is_same<decltype(std::remquol(0,0, &ip)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::remquo((int)0, (int)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(remquo(Ambiguous(), Ambiguous(), &ip)), Ambiguous>::value), "");
+    assert(std::remquo(0.5,1, &ip) == 0.5);
+}
+
+void test_rint()
+{
+    static_assert((std::is_same<decltype(std::rint((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::rint((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::rint((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::rint((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::rint((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::rint((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::rint((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::rint((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::rint((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::rint((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::rint((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::rintf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::rintl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(rint(Ambiguous())), Ambiguous>::value), "");
+    assert(std::rint(1) == 1);
+}
+
+void test_round()
+{
+    static_assert((std::is_same<decltype(std::round((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::round((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::round((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::round((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::round((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::round((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::round((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::round((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::round((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::round((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::round((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::roundf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::roundl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(round(Ambiguous())), Ambiguous>::value), "");
+    assert(std::round(1) == 1);
+}
+
+void test_scalbln()
+{
+    static_assert((std::is_same<decltype(std::scalbln((float)0, (long)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::scalbln((bool)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbln((unsigned short)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbln((int)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbln((unsigned int)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbln((long)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbln((unsigned long)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbln((long long)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbln((unsigned long long)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbln((double)0, (long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbln((long double)0, (long)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::scalblnf(0, (long)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::scalblnl(0, (long)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(scalbln(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::scalbln(1, 1) == 2);
+}
+
+void test_scalbn()
+{
+    static_assert((std::is_same<decltype(std::scalbn((float)0, (int)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::scalbn((bool)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbn((unsigned short)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbn((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbn((unsigned int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbn((long)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbn((unsigned long)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbn((long long)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbn((unsigned long long)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbn((double)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbn((long double)0, (int)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::scalbnf(0, (int)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::scalbnl(0, (int)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(scalbn(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+    assert(std::scalbn(1, 1) == 2);
+}
+
+void test_tgamma()
+{
+    static_assert((std::is_same<decltype(std::tgamma((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::tgamma((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tgamma((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tgamma((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tgamma((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tgamma((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tgamma((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tgamma((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tgamma((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tgamma((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::tgamma((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::tgammaf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::tgammal(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(tgamma(Ambiguous())), Ambiguous>::value), "");
+    assert(std::tgamma(1) == 1);
+}
+
+void test_trunc()
+{
+    static_assert((std::is_same<decltype(std::trunc((float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::trunc((bool)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::trunc((unsigned short)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::trunc((int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::trunc((unsigned int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::trunc((long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::trunc((unsigned long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::trunc((long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::trunc((unsigned long long)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::trunc((double)0)), double>::value), "");
+    static_assert((std::is_same<decltype(std::trunc((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(std::truncf(0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::truncl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(trunc(Ambiguous())), Ambiguous>::value), "");
+    assert(std::trunc(1) == 1);
+}
+
+int main()
+{
+    test_abs();
+    test_acos();
+    test_asin();
+    test_atan();
+    test_atan2();
+    test_ceil();
+    test_cos();
+    test_cosh();
+    test_exp();
+    test_fabs();
+    test_floor();
+    test_fmod();
+    test_frexp();
+    test_ldexp();
+    test_log();
+    test_log10();
+    test_modf();
+    test_pow();
+    test_sin();
+    test_sinh();
+    test_sqrt();
+    test_tan();
+    test_tanh();
+    test_signbit();
+    test_fpclassify();
+    test_isfinite();
+    test_isnormal();
+    test_isgreater();
+    test_isgreaterequal();
+    test_isless();
+    test_islessequal();
+    test_islessgreater();
+    test_isunordered();
+    test_acosh();
+    test_asinh();
+    test_atanh();
+    test_cbrt();
+    test_copysign();
+    test_erf();
+    test_erfc();
+    test_exp2();
+    test_expm1();
+    test_fdim();
+    test_fma();
+    test_fmax();
+    test_fmin();
+    test_hypot();
+    test_ilogb();
+    test_lgamma();
+    test_llrint();
+    test_llround();
+    test_log1p();
+    test_log2();
+    test_logb();
+    test_lrint();
+    test_lround();
+    test_nan();
+    test_nearbyint();
+    test_nextafter();
+    test_nexttoward();
+    test_remainder();
+    test_remquo();
+    test_rint();
+    test_round();
+    test_scalbln();
+    test_scalbn();
+    test_tgamma();
+    test_trunc();
+}

Added: libcxx/trunk/test/std/numerics/c.math/cmath_isinf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/c.math/cmath_isinf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/c.math/cmath_isinf.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/c.math/cmath_isinf.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <cmath>
+
+// isinf
+
+// XFAIL: linux
+
+#include <cmath>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+#ifdef isinf
+#error isinf defined
+#endif
+    static_assert((std::is_same<decltype(std::isinf((float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isinf((double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isinf(0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isinf((long double)0)), bool>::value), "");
+    assert(std::isinf(-1.0) == false);
+}
\ No newline at end of file

Added: libcxx/trunk/test/std/numerics/c.math/cmath_isnan.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/c.math/cmath_isnan.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/c.math/cmath_isnan.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/c.math/cmath_isnan.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <cmath>
+
+// isnan
+
+// XFAIL: linux
+
+#include <cmath>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+#ifdef isnan
+#error isnan defined
+#endif
+    static_assert((std::is_same<decltype(std::isnan((float)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isnan((double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isnan(0)), bool>::value), "");
+    static_assert((std::is_same<decltype(std::isnan((long double)0)), bool>::value), "");
+    assert(std::isnan(-1.0) == false);
+}

Added: libcxx/trunk/test/std/numerics/c.math/ctgmath.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/c.math/ctgmath.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/c.math/ctgmath.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/c.math/ctgmath.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ctgmath>
+
+#include <ctgmath>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+    std::complex<double> cd;
+    double x = std::sin(0);
+}

Added: libcxx/trunk/test/std/numerics/c.math/tgmath_h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/c.math/tgmath_h.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/c.math/tgmath_h.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/c.math/tgmath_h.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <tgmath.h>
+
+#include <tgmath.h>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/numerics/c.math/version_cmath.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/c.math/version_cmath.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/c.math/version_cmath.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/c.math/version_cmath.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <cmath>
+
+#include <cmath>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: newlib
+
+// <cfenv>
+
+#include <cfenv>
+#include <type_traits>
+
+#ifndef FE_DIVBYZERO
+#error FE_DIVBYZERO not defined
+#endif
+
+#ifndef FE_INEXACT
+#error FE_INEXACT not defined
+#endif
+
+#ifndef FE_INVALID
+#error FE_INVALID not defined
+#endif
+
+#ifndef FE_OVERFLOW
+#error FE_OVERFLOW not defined
+#endif
+
+#ifndef FE_UNDERFLOW
+#error FE_UNDERFLOW not defined
+#endif
+
+#ifndef FE_ALL_EXCEPT
+#error FE_ALL_EXCEPT not defined
+#endif
+
+#ifndef FE_DOWNWARD
+#error FE_DOWNWARD not defined
+#endif
+
+#ifndef FE_TONEAREST
+#error FE_TONEAREST not defined
+#endif
+
+#ifndef FE_TOWARDZERO
+#error FE_TOWARDZERO not defined
+#endif
+
+#ifndef FE_UPWARD
+#error FE_UPWARD not defined
+#endif
+
+#ifndef FE_DFL_ENV
+#error FE_DFL_ENV not defined
+#endif
+
+int main()
+{
+    std::fenv_t fenv = {0};
+    std::fexcept_t fex = 0;
+    static_assert((std::is_same<decltype(std::feclearexcept(0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fegetexceptflag(&fex, 0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::feraiseexcept(0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fesetexceptflag(&fex, 0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fetestexcept(0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fegetround()), int>::value), "");
+    static_assert((std::is_same<decltype(std::fesetround(0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fegetenv(&fenv)), int>::value), "");
+    static_assert((std::is_same<decltype(std::feholdexcept(&fenv)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fesetenv(&fenv)), int>::value), "");
+    static_assert((std::is_same<decltype(std::feupdateenv(&fenv)), int>::value), "");
+}

Added: libcxx/trunk/test/std/numerics/cfenv/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/cfenv/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/cfenv/version.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/cfenv/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: newlib
+
+// <cfenv>
+
+#include <cfenv>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/numerics/complex.number/cases.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/cases.h?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/cases.h (added)
+++ libcxx/trunk/test/std/numerics/complex.number/cases.h Fri Dec 19 19:40:03 2014
@@ -0,0 +1,230 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// test cases
+
+#ifndef CASES_H
+#define CASES_H
+
+#include <complex>
+#include <cassert>
+
+std::complex<double> x[] =
+{
+    std::complex<double>( 1.e-6,  1.e-6),
+    std::complex<double>(-1.e-6,  1.e-6),
+    std::complex<double>(-1.e-6, -1.e-6),
+    std::complex<double>( 1.e-6, -1.e-6),
+
+    std::complex<double>( 1.e+6,  1.e-6),
+    std::complex<double>(-1.e+6,  1.e-6),
+    std::complex<double>(-1.e+6, -1.e-6),
+    std::complex<double>( 1.e+6, -1.e-6),
+
+    std::complex<double>( 1.e-6,  1.e+6),
+    std::complex<double>(-1.e-6,  1.e+6),
+    std::complex<double>(-1.e-6, -1.e+6),
+    std::complex<double>( 1.e-6, -1.e+6),
+
+    std::complex<double>( 1.e+6,  1.e+6),
+    std::complex<double>(-1.e+6,  1.e+6),
+    std::complex<double>(-1.e+6, -1.e+6),
+    std::complex<double>( 1.e+6, -1.e+6),
+
+    std::complex<double>(NAN, NAN),
+    std::complex<double>(-INFINITY, NAN),
+    std::complex<double>(-2, NAN),
+    std::complex<double>(-1, NAN),
+    std::complex<double>(-0.5, NAN),
+    std::complex<double>(-0., NAN),
+    std::complex<double>(+0., NAN),
+    std::complex<double>(0.5, NAN),
+    std::complex<double>(1, NAN),
+    std::complex<double>(2, NAN),
+    std::complex<double>(INFINITY, NAN),
+
+    std::complex<double>(NAN, -INFINITY),
+    std::complex<double>(-INFINITY, -INFINITY),
+    std::complex<double>(-2, -INFINITY),
+    std::complex<double>(-1, -INFINITY),
+    std::complex<double>(-0.5, -INFINITY),
+    std::complex<double>(-0., -INFINITY),
+    std::complex<double>(+0., -INFINITY),
+    std::complex<double>(0.5, -INFINITY),
+    std::complex<double>(1, -INFINITY),
+    std::complex<double>(2, -INFINITY),
+    std::complex<double>(INFINITY, -INFINITY),
+
+    std::complex<double>(NAN, -2),
+    std::complex<double>(-INFINITY, -2),
+    std::complex<double>(-2, -2),
+    std::complex<double>(-1, -2),
+    std::complex<double>(-0.5, -2),
+    std::complex<double>(-0., -2),
+    std::complex<double>(+0., -2),
+    std::complex<double>(0.5, -2),
+    std::complex<double>(1, -2),
+    std::complex<double>(2, -2),
+    std::complex<double>(INFINITY, -2),
+
+    std::complex<double>(NAN, -1),
+    std::complex<double>(-INFINITY, -1),
+    std::complex<double>(-2, -1),
+    std::complex<double>(-1, -1),
+    std::complex<double>(-0.5, -1),
+    std::complex<double>(-0., -1),
+    std::complex<double>(+0., -1),
+    std::complex<double>(0.5, -1),
+    std::complex<double>(1, -1),
+    std::complex<double>(2, -1),
+    std::complex<double>(INFINITY, -1),
+
+    std::complex<double>(NAN, -0.5),
+    std::complex<double>(-INFINITY, -0.5),
+    std::complex<double>(-2, -0.5),
+    std::complex<double>(-1, -0.5),
+    std::complex<double>(-0.5, -0.5),
+    std::complex<double>(-0., -0.5),
+    std::complex<double>(+0., -0.5),
+    std::complex<double>(0.5, -0.5),
+    std::complex<double>(1, -0.5),
+    std::complex<double>(2, -0.5),
+    std::complex<double>(INFINITY, -0.5),
+
+    std::complex<double>(NAN, -0.),
+    std::complex<double>(-INFINITY, -0.),
+    std::complex<double>(-2, -0.),
+    std::complex<double>(-1, -0.),
+    std::complex<double>(-0.5, -0.),
+    std::complex<double>(-0., -0.),
+    std::complex<double>(+0., -0.),
+    std::complex<double>(0.5, -0.),
+    std::complex<double>(1, -0.),
+    std::complex<double>(2, -0.),
+    std::complex<double>(INFINITY, -0.),
+
+    std::complex<double>(NAN, +0.),
+    std::complex<double>(-INFINITY, +0.),
+    std::complex<double>(-2, +0.),
+    std::complex<double>(-1, +0.),
+    std::complex<double>(-0.5, +0.),
+    std::complex<double>(-0., +0.),
+    std::complex<double>(+0., +0.),
+    std::complex<double>(0.5, +0.),
+    std::complex<double>(1, +0.),
+    std::complex<double>(2, +0.),
+    std::complex<double>(INFINITY, +0.),
+
+    std::complex<double>(NAN, 0.5),
+    std::complex<double>(-INFINITY, 0.5),
+    std::complex<double>(-2, 0.5),
+    std::complex<double>(-1, 0.5),
+    std::complex<double>(-0.5, 0.5),
+    std::complex<double>(-0., 0.5),
+    std::complex<double>(+0., 0.5),
+    std::complex<double>(0.5, 0.5),
+    std::complex<double>(1, 0.5),
+    std::complex<double>(2, 0.5),
+    std::complex<double>(INFINITY, 0.5),
+
+    std::complex<double>(NAN, 1),
+    std::complex<double>(-INFINITY, 1),
+    std::complex<double>(-2, 1),
+    std::complex<double>(-1, 1),
+    std::complex<double>(-0.5, 1),
+    std::complex<double>(-0., 1),
+    std::complex<double>(+0., 1),
+    std::complex<double>(0.5, 1),
+    std::complex<double>(1, 1),
+    std::complex<double>(2, 1),
+    std::complex<double>(INFINITY, 1),
+
+    std::complex<double>(NAN, 2),
+    std::complex<double>(-INFINITY, 2),
+    std::complex<double>(-2, 2),
+    std::complex<double>(-1, 2),
+    std::complex<double>(-0.5, 2),
+    std::complex<double>(-0., 2),
+    std::complex<double>(+0., 2),
+    std::complex<double>(0.5, 2),
+    std::complex<double>(1, 2),
+    std::complex<double>(2, 2),
+    std::complex<double>(INFINITY, 2),
+
+    std::complex<double>(NAN, INFINITY),
+    std::complex<double>(-INFINITY, INFINITY),
+    std::complex<double>(-2, INFINITY),
+    std::complex<double>(-1, INFINITY),
+    std::complex<double>(-0.5, INFINITY),
+    std::complex<double>(-0., INFINITY),
+    std::complex<double>(+0., INFINITY),
+    std::complex<double>(0.5, INFINITY),
+    std::complex<double>(1, INFINITY),
+    std::complex<double>(2, INFINITY),
+    std::complex<double>(INFINITY, INFINITY)
+};
+
+enum {zero, non_zero, inf, NaN, non_zero_nan};
+
+template <class T>
+int
+classify(const std::complex<T>& x)
+{
+    if (x == std::complex<T>())
+        return zero;
+    if (std::isinf(x.real()) || std::isinf(x.imag()))
+        return inf;
+    if (std::isnan(x.real()) && std::isnan(x.imag()))
+        return NaN;
+    if (std::isnan(x.real()))
+    {
+        if (x.imag() == T(0))
+            return NaN;
+        return non_zero_nan;
+    }
+    if (std::isnan(x.imag()))
+    {
+        if (x.real() == T(0))
+            return NaN;
+        return non_zero_nan;
+    }
+    return non_zero;
+}
+
+inline
+int
+classify(double x)
+{
+    if (x == 0)
+        return zero;
+    if (std::isinf(x))
+        return inf;
+    if (std::isnan(x))
+        return NaN;
+    return non_zero;
+}
+
+void is_about(float x, float y)
+{
+    assert(std::abs((x-y)/(x+y)) < 1.e-6);
+}
+
+void is_about(double x, double y)
+{
+    assert(std::abs((x-y)/(x+y)) < 1.e-14);
+}
+
+void is_about(long double x, long double y)
+{
+    assert(std::abs((x-y)/(x+y)) < 1.e-14);
+}
+
+#endif  // CASES_H

Added: libcxx/trunk/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ccomplex>
+
+#include <ccomplex>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+    std::complex<double> d;
+}

Added: libcxx/trunk/test/std/numerics/complex.number/cmplx.over/arg.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/cmplx.over/arg.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/cmplx.over/arg.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/cmplx.over/arg.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<Arithmetic T>
+//   T
+//   arg(T x);
+
+#include <complex>
+#include <type_traits>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(T x, typename std::enable_if<std::is_integral<T>::value>::type* = 0)
+{
+    static_assert((std::is_same<decltype(std::arg(x)), double>::value), "");
+    assert(std::arg(x) == arg(std::complex<double>(x, 0)));
+}
+
+template <class T>
+void
+test(T x, typename std::enable_if<!std::is_integral<T>::value>::type* = 0)
+{
+    static_assert((std::is_same<decltype(std::arg(x)), T>::value), "");
+    assert(std::arg(x) == arg(std::complex<T>(x, 0)));
+}
+
+template <class T>
+void
+test()
+{
+    test<T>(0);
+    test<T>(1);
+    test<T>(10);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test<int>();
+    test<unsigned>();
+    test<long long>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/cmplx.over/conj.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/cmplx.over/conj.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/cmplx.over/conj.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/cmplx.over/conj.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>      complex<T>           conj(const complex<T>&);
+//                        complex<long double> conj(long double);
+//                        complex<double>      conj(double);
+// template<Integral T>   complex<double>      conj(T);
+//                        complex<float>       conj(float);
+
+#include <complex>
+#include <type_traits>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(T x, typename std::enable_if<std::is_integral<T>::value>::type* = 0)
+{
+    static_assert((std::is_same<decltype(std::conj(x)), std::complex<double> >::value), "");
+    assert(std::conj(x) == conj(std::complex<double>(x, 0)));
+}
+
+template <class T>
+void
+test(T x, typename std::enable_if<std::is_floating_point<T>::value>::type* = 0)
+{
+    static_assert((std::is_same<decltype(std::conj(x)), std::complex<T> >::value), "");
+    assert(std::conj(x) == conj(std::complex<T>(x, 0)));
+}
+
+template <class T>
+void
+test(T x, typename std::enable_if<!std::is_integral<T>::value &&
+                                  !std::is_floating_point<T>::value>::type* = 0)
+{
+    static_assert((std::is_same<decltype(std::conj(x)), std::complex<T> >::value), "");
+    assert(std::conj(x) == conj(std::complex<T>(x, 0)));
+}
+
+template <class T>
+void
+test()
+{
+    test<T>(0);
+    test<T>(1);
+    test<T>(10);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test<int>();
+    test<unsigned>();
+    test<long long>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/cmplx.over/imag.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/cmplx.over/imag.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/cmplx.over/imag.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/cmplx.over/imag.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<Arithmetic T>
+//   T
+//   imag(const T& x);
+
+#include <complex>
+#include <type_traits>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T, int x>
+void
+test(typename std::enable_if<std::is_integral<T>::value>::type* = 0)
+{
+    static_assert((std::is_same<decltype(std::imag(T(x))), double>::value), "");
+    assert(std::imag(x) == 0);
+#if _LIBCPP_STD_VER > 11
+    constexpr T val {x};
+    static_assert(std::imag(val) == 0, "");
+    constexpr std::complex<T> t{val, val};
+    static_assert(t.imag() == x, "" );
+#endif    
+}
+
+template <class T, int x>
+void
+test(typename std::enable_if<!std::is_integral<T>::value>::type* = 0)
+{
+    static_assert((std::is_same<decltype(std::imag(T(x))), T>::value), "");
+    assert(std::imag(x) == 0);
+#if _LIBCPP_STD_VER > 11
+    constexpr T val {x};
+    static_assert(std::imag(val) == 0, "");
+    constexpr std::complex<T> t{val, val};
+    static_assert(t.imag() == x, "" );
+#endif    
+}
+
+template <class T>
+void
+test()
+{
+    test<T, 0>();
+    test<T, 1>();
+    test<T, 10>();
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test<int>();
+    test<unsigned>();
+    test<long long>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/cmplx.over/norm.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/cmplx.over/norm.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/cmplx.over/norm.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/cmplx.over/norm.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<Arithmetic T>
+//   T
+//   norm(T x);
+
+#include <complex>
+#include <type_traits>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(T x, typename std::enable_if<std::is_integral<T>::value>::type* = 0)
+{
+    static_assert((std::is_same<decltype(std::norm(x)), double>::value), "");
+    assert(std::norm(x) == norm(std::complex<double>(x, 0)));
+}
+
+template <class T>
+void
+test(T x, typename std::enable_if<!std::is_integral<T>::value>::type* = 0)
+{
+    static_assert((std::is_same<decltype(std::norm(x)), T>::value), "");
+    assert(std::norm(x) == norm(std::complex<T>(x, 0)));
+}
+
+template <class T>
+void
+test()
+{
+    test<T>(0);
+    test<T>(1);
+    test<T>(10);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test<int>();
+    test<unsigned>();
+    test<long long>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/cmplx.over/pow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/cmplx.over/pow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/cmplx.over/pow.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/cmplx.over/pow.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,104 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<Arithmetic T, Arithmetic U>
+//   complex<promote<T, U>::type>
+//   pow(const T& x, const complex<U>& y);
+
+// template<Arithmetic T, Arithmetic U>
+//   complex<promote<T, U>::type>
+//   pow(const complex<T>& x, const U& y);
+
+// template<Arithmetic T, Arithmetic U>
+//   complex<promote<T, U>::type>
+//   pow(const complex<T>& x, const complex<U>& y);
+
+#include <complex>
+#include <type_traits>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+double
+promote(T, typename std::enable_if<std::is_integral<T>::value>::type* = 0);
+
+float promote(float);
+double promote(double);
+long double promote(long double);
+
+template <class T, class U>
+void
+test(T x, const std::complex<U>& y)
+{
+    typedef decltype(promote(x)+promote(real(y))) V;
+    static_assert((std::is_same<decltype(std::pow(x, y)), std::complex<V> >::value), "");
+    assert(std::pow(x, y) == pow(std::complex<V>(x, 0), std::complex<V>(y)));
+}
+
+template <class T, class U>
+void
+test(const std::complex<T>& x, U y)
+{
+    typedef decltype(promote(real(x))+promote(y)) V;
+    static_assert((std::is_same<decltype(std::pow(x, y)), std::complex<V> >::value), "");
+    assert(std::pow(x, y) == pow(std::complex<V>(x), std::complex<V>(y, 0)));
+}
+
+template <class T, class U>
+void
+test(const std::complex<T>& x, const std::complex<U>& y)
+{
+    typedef decltype(promote(real(x))+promote(real(y))) V;
+    static_assert((std::is_same<decltype(std::pow(x, y)), std::complex<V> >::value), "");
+    assert(std::pow(x, y) == pow(std::complex<V>(x), std::complex<V>(y)));
+}
+
+template <class T, class U>
+void
+test(typename std::enable_if<std::is_integral<T>::value>::type* = 0, typename std::enable_if<!std::is_integral<U>::value>::type* = 0)
+{
+    test(T(3), std::complex<U>(4, 5));
+    test(std::complex<U>(3, 4), T(5));
+}
+
+template <class T, class U>
+void
+test(typename std::enable_if<!std::is_integral<T>::value>::type* = 0, typename std::enable_if<!std::is_integral<U>::value>::type* = 0)
+{
+    test(T(3), std::complex<U>(4, 5));
+    test(std::complex<T>(3, 4), U(5));
+    test(std::complex<T>(3, 4), std::complex<U>(5, 6));
+}
+
+int main()
+{
+    test<int, float>();
+    test<int, double>();
+    test<int, long double>();
+
+    test<unsigned, float>();
+    test<unsigned, double>();
+    test<unsigned, long double>();
+
+    test<long long, float>();
+    test<long long, double>();
+    test<long long, long double>();
+
+    test<float, double>();
+    test<float, long double>();
+
+    test<double, float>();
+    test<double, long double>();
+
+    test<long double, float>();
+    test<long double, double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/cmplx.over/proj.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/cmplx.over/proj.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/cmplx.over/proj.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/cmplx.over/proj.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>    complex<T>           proj(const complex<T>&);
+//                      complex<long double> proj(long double);
+//                      complex<double>      proj(double);
+// template<Integral T> complex<double>      proj(T);
+//                      complex<float>       proj(float);
+
+#include <complex>
+#include <type_traits>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(T x, typename std::enable_if<std::is_integral<T>::value>::type* = 0)
+{
+    static_assert((std::is_same<decltype(std::proj(x)), std::complex<double> >::value), "");
+    assert(std::proj(x) == proj(std::complex<double>(x, 0)));
+}
+
+template <class T>
+void
+test(T x, typename std::enable_if<std::is_floating_point<T>::value>::type* = 0)
+{
+    static_assert((std::is_same<decltype(std::proj(x)), std::complex<T> >::value), "");
+    assert(std::proj(x) == proj(std::complex<T>(x, 0)));
+}
+
+template <class T>
+void
+test(T x, typename std::enable_if<!std::is_integral<T>::value &&
+                                  !std::is_floating_point<T>::value>::type* = 0)
+{
+    static_assert((std::is_same<decltype(std::proj(x)), std::complex<T> >::value), "");
+    assert(std::proj(x) == proj(std::complex<T>(x, 0)));
+}
+
+template <class T>
+void
+test()
+{
+    test<T>(0);
+    test<T>(1);
+    test<T>(10);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test<int>();
+    test<unsigned>();
+    test<long long>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/cmplx.over/real.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/cmplx.over/real.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/cmplx.over/real.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/cmplx.over/real.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<Arithmetic T>
+//   T
+//   real(const T& x);
+
+#include <complex>
+#include <type_traits>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T, int x>
+void
+test(typename std::enable_if<std::is_integral<T>::value>::type* = 0)
+{
+    static_assert((std::is_same<decltype(std::real(T(x))), double>::value), "");
+    assert(std::real(x) == x);
+#if _LIBCPP_STD_VER > 11
+    constexpr T val {x};
+    static_assert(std::real(val) == val, "");
+    constexpr std::complex<T> t{val, val};
+    static_assert(t.real() == x, "" );
+#endif    
+}
+
+template <class T, int x>
+void
+test(typename std::enable_if<!std::is_integral<T>::value>::type* = 0)
+{
+    static_assert((std::is_same<decltype(std::real(T(x))), T>::value), "");
+    assert(std::real(x) == x);
+#if _LIBCPP_STD_VER > 11
+    constexpr T val {x};
+    static_assert(std::real(val) == val, "");
+    constexpr std::complex<T> t{val, val};
+    static_assert(t.real() == x, "" );
+#endif    
+}
+
+template <class T>
+void
+test()
+{
+    test<T, 0>();
+    test<T, 1>();
+    test<T, 10>();
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test<int>();
+    test<unsigned>();
+    test<long long>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.literals/literals.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.literals/literals.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.literals/literals.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.literals/literals.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+#include <complex>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11 
+    using namespace std::literals::complex_literals;
+
+//  Make sure the types are right
+    static_assert ( std::is_same<decltype( 3.0il ), std::complex<long double>>::value, "" );
+    static_assert ( std::is_same<decltype( 3il   ), std::complex<long double>>::value, "" );
+    static_assert ( std::is_same<decltype( 3.0i  ), std::complex<double>>::value, "" );
+    static_assert ( std::is_same<decltype( 3i    ), std::complex<double>>::value, "" );
+    static_assert ( std::is_same<decltype( 3.0if ), std::complex<float>>::value, "" );
+    static_assert ( std::is_same<decltype( 3if   ), std::complex<float>>::value, "" );
+    
+    {
+    std::complex<long double> c1 = 3.0il;
+    assert ( c1 == std::complex<long double>(0, 3.0));
+    auto c2 = 3il;
+    assert ( c1 == c2 );
+    }
+    
+    {
+    std::complex<double> c1 = 3.0i;
+    assert ( c1 == std::complex<double>(0, 3.0));
+    auto c2 = 3i;
+    assert ( c1 == c2 );
+    }
+
+    {
+    std::complex<float> c1 = 3.0if;
+    assert ( c1 == std::complex<float>(0, 3.0));
+    auto c2 = 3if;
+    assert ( c1 == c2 );
+    }
+
+#endif
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#include <complex>
+#include <cassert>
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11 
+    std::complex<float> foo  = 1.0if;  // should fail w/conversion operator not found
+#else
+#error
+#endif
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.literals/literals1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.literals/literals1.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.literals/literals1.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.literals/literals1.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+#include <complex>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11 
+    using namespace std::literals;
+
+    {
+    std::complex<long double> c1 = 3.0il;
+    assert ( c1 == std::complex<long double>(0, 3.0));
+    auto c2 = 3il;
+    assert ( c1 == c2 );
+    }
+    
+    {
+    std::complex<double> c1 = 3.0i;
+    assert ( c1 == std::complex<double>(0, 3.0));
+    auto c2 = 3i;
+    assert ( c1 == c2 );
+    }
+
+    {
+    std::complex<float> c1 = 3.0if;
+    assert ( c1 == std::complex<float>(0, 3.0));
+    auto c2 = 3if;
+    assert ( c1 == c2 );
+    }
+
+#endif
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.literals/literals2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.literals/literals2.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.literals/literals2.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.literals/literals2.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+#include <complex>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11 
+    using namespace std;
+
+    {
+    std::complex<long double> c1 = 3.0il;
+    assert ( c1 == std::complex<long double>(0, 3.0));
+    auto c2 = 3il;
+    assert ( c1 == c2 );
+    }
+    
+    {
+    std::complex<double> c1 = 3.0i;
+    assert ( c1 == std::complex<double>(0, 3.0));
+    auto c2 = 3i;
+    assert ( c1 == c2 );
+    }
+
+    {
+    std::complex<float> c1 = 3.0if;
+    assert ( c1 == std::complex<float>(0, 3.0));
+    auto c2 = 3if;
+    assert ( c1 == c2 );
+    }
+
+#endif
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/assignment_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/assignment_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/assignment_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/assignment_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// complex& operator=(const complex&);
+// template<class X> complex& operator= (const complex<X>&);
+
+#include <complex>
+#include <cassert>
+
+template <class T, class X>
+void
+test()
+{
+    std::complex<T> c;
+    assert(c.real() == 0);
+    assert(c.imag() == 0);
+    std::complex<T> c2(1.5, 2.5);
+    c = c2;
+    assert(c.real() == 1.5);
+    assert(c.imag() == 2.5);
+    std::complex<X> c3(3.5, -4.5);
+    c = c3;
+    assert(c.real() == 3.5);
+    assert(c.imag() == -4.5);
+}
+
+int main()
+{
+    test<float, float>();
+    test<float, double>();
+    test<float, long double>();
+
+    test<double, float>();
+    test<double, double>();
+    test<double, long double>();
+
+    test<long double, float>();
+    test<long double, double>();
+    test<long double, long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/assignment_scalar.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/assignment_scalar.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/assignment_scalar.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/assignment_scalar.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// complex& operator= (const T&);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    std::complex<T> c;
+    assert(c.real() == 0);
+    assert(c.imag() == 0);
+    c = 1.5;
+    assert(c.real() == 1.5);
+    assert(c.imag() == 0);
+    c = -1.5;
+    assert(c.real() == -1.5);
+    assert(c.imag() == 0);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/divide_equal_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/divide_equal_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/divide_equal_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/divide_equal_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// complex& operator/=(const complex& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    std::complex<T> c(-4, 7.5);
+    const std::complex<T> c2(1.5, 2.5);
+    assert(c.real() == -4);
+    assert(c.imag() == 7.5);
+    c /= c2;
+    assert(c.real() == 1.5);
+    assert(c.imag() == 2.5);
+    c /= c2;
+    assert(c.real() == 1);
+    assert(c.imag() == 0);
+    
+    std::complex<T> c3;
+
+    c3 = c;
+    std::complex<int> ic (1,1);
+    c3 /= ic;
+    assert(c3.real() ==  0.5);
+    assert(c3.imag() == -0.5);
+    
+    c3 = c;
+    std::complex<float> fc (1,1);
+    c3 /= fc;
+    assert(c3.real() ==  0.5);
+    assert(c3.imag() == -0.5);
+    
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/divide_equal_scalar.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/divide_equal_scalar.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/divide_equal_scalar.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/divide_equal_scalar.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// complex& operator/=(const T& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    std::complex<T> c(1);
+    assert(c.real() == 1);
+    assert(c.imag() == 0);
+    c /= 0.5;
+    assert(c.real() == 2);
+    assert(c.imag() == 0);
+    c /= 0.5;
+    assert(c.real() == 4);
+    assert(c.imag() == 0);
+    c /= -0.5;
+    assert(c.real() == -8);
+    assert(c.imag() == 0);
+    c.imag(2);
+    c /= 0.5;
+    assert(c.real() == -16);
+    assert(c.imag() == 4);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/minus_equal_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/minus_equal_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/minus_equal_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/minus_equal_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// complex& operator-=(const complex& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    std::complex<T> c;
+    const std::complex<T> c2(1.5, 2.5);
+    assert(c.real() == 0);
+    assert(c.imag() == 0);
+    c -= c2;
+    assert(c.real() == -1.5);
+    assert(c.imag() == -2.5);
+    c -= c2;
+    assert(c.real() == -3);
+    assert(c.imag() == -5);
+
+    std::complex<T> c3;
+
+    c3 = c;
+    std::complex<int> ic (1,1);
+    c3 -= ic;
+    assert(c3.real() == -4);
+    assert(c3.imag() == -6);
+
+    c3 = c;
+    std::complex<float> fc (1,1);
+    c3 -= fc;
+    assert(c3.real() == -4);
+    assert(c3.imag() == -6);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/minus_equal_scalar.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/minus_equal_scalar.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/minus_equal_scalar.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/minus_equal_scalar.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// complex& operator-=(const T& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    std::complex<T> c;
+    assert(c.real() == 0);
+    assert(c.imag() == 0);
+    c -= 1.5;
+    assert(c.real() == -1.5);
+    assert(c.imag() == 0);
+    c -= 1.5;
+    assert(c.real() == -3);
+    assert(c.imag() == 0);
+    c -= -1.5;
+    assert(c.real() == -1.5);
+    assert(c.imag() == 0);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/plus_equal_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/plus_equal_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/plus_equal_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/plus_equal_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// complex& operator+=(const complex& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    std::complex<T> c;
+    const std::complex<T> c2(1.5, 2.5);
+    assert(c.real() == 0);
+    assert(c.imag() == 0);
+    c += c2;
+    assert(c.real() == 1.5);
+    assert(c.imag() == 2.5);
+    c += c2;
+    assert(c.real() == 3);
+    assert(c.imag() == 5);
+
+    std::complex<T> c3;
+
+    c3 = c;
+    std::complex<int> ic (1,1);
+    c3 += ic;
+    assert(c3.real() == 4);
+    assert(c3.imag() == 6);
+    
+    c3 = c;
+    std::complex<float> fc (1,1);
+    c3 += fc;
+    assert(c3.real() == 4);
+    assert(c3.imag() == 6);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/plus_equal_scalar.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/plus_equal_scalar.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/plus_equal_scalar.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/plus_equal_scalar.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// complex& operator+=(const T& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    std::complex<T> c;
+    assert(c.real() == 0);
+    assert(c.imag() == 0);
+    c += 1.5;
+    assert(c.real() == 1.5);
+    assert(c.imag() == 0);
+    c += 1.5;
+    assert(c.real() == 3);
+    assert(c.imag() == 0);
+    c += -1.5;
+    assert(c.real() == 1.5);
+    assert(c.imag() == 0);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/times_equal_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/times_equal_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/times_equal_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/times_equal_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// complex& operator*=(const complex& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    std::complex<T> c(1);
+    const std::complex<T> c2(1.5, 2.5);
+    assert(c.real() == 1);
+    assert(c.imag() == 0);
+    c *= c2;
+    assert(c.real() == 1.5);
+    assert(c.imag() == 2.5);
+    c *= c2;
+    assert(c.real() == -4);
+    assert(c.imag() == 7.5);
+
+    std::complex<T> c3;
+
+    c3 = c;
+    std::complex<int> ic (1,1);
+    c3 *= ic;
+    assert(c3.real() == -11.5);
+    assert(c3.imag() ==   3.5);
+    
+    c3 = c;
+    std::complex<float> fc (1,1);
+    c3 *= fc;
+    assert(c3.real() == -11.5);
+    assert(c3.imag() ==   3.5);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/times_equal_scalar.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/times_equal_scalar.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/times_equal_scalar.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.member.ops/times_equal_scalar.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// complex& operator*=(const T& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    std::complex<T> c(1);
+    assert(c.real() == 1);
+    assert(c.imag() == 0);
+    c *= 1.5;
+    assert(c.real() == 1.5);
+    assert(c.imag() == 0);
+    c *= 1.5;
+    assert(c.real() == 2.25);
+    assert(c.imag() == 0);
+    c *= -1.5;
+    assert(c.real() == -3.375);
+    assert(c.imag() == 0);
+    c.imag(2);
+    c *= 1.5;
+    assert(c.real() == -5.0625);
+    assert(c.imag() == 3);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.members/construct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.members/construct.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.members/construct.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.members/construct.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// constexpr complex(const T& re = T(), const T& im = T());
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    {
+    const std::complex<T> c;
+    assert(c.real() == 0);
+    assert(c.imag() == 0);
+    }
+    {
+    const std::complex<T> c = 7.5;
+    assert(c.real() == 7.5);
+    assert(c.imag() == 0);
+    }
+    {
+    const std::complex<T> c(8.5);
+    assert(c.real() == 8.5);
+    assert(c.imag() == 0);
+    }
+    {
+    const std::complex<T> c(10.5, -9.5);
+    assert(c.real() == 10.5);
+    assert(c.imag() == -9.5);
+    }
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+    {
+    constexpr std::complex<T> c;
+    static_assert(c.real() == 0, "");
+    static_assert(c.imag() == 0, "");
+    }
+    {
+    constexpr std::complex<T> c = 7.5;
+    static_assert(c.real() == 7.5, "");
+    static_assert(c.imag() == 0, "");
+    }
+    {
+    constexpr std::complex<T> c(8.5);
+    static_assert(c.real() == 8.5, "");
+    static_assert(c.imag() == 0, "");
+    }
+    {
+    constexpr std::complex<T> c(10.5, -9.5);
+    static_assert(c.real() == 10.5, "");
+    static_assert(c.imag() == -9.5, "");
+    }
+#endif
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.members/real_imag.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.members/real_imag.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.members/real_imag.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.members/real_imag.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// void real(T val);
+// void imag(T val);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test_constexpr()
+{
+#if _LIBCPP_STD_VER > 11
+    constexpr std::complex<T> c1;
+    static_assert(c1.real() == 0, "");
+    static_assert(c1.imag() == 0, "");
+    constexpr std::complex<T> c2(3);
+    static_assert(c2.real() == 3, "");
+    static_assert(c2.imag() == 0, "");
+    constexpr std::complex<T> c3(3, 4);
+    static_assert(c3.real() == 3, "");
+    static_assert(c3.imag() == 4, "");
+#endif
+}
+
+template <class T>
+void
+test()
+{
+    std::complex<T> c;
+    assert(c.real() == 0);
+    assert(c.imag() == 0);
+    c.real(3.5);
+    assert(c.real() == 3.5);
+    assert(c.imag() == 0);
+    c.imag(4.5);
+    assert(c.real() == 3.5);
+    assert(c.imag() == 4.5);
+    c.real(-4.5);
+    assert(c.real() == -4.5);
+    assert(c.imag() == 4.5);
+    c.imag(-5.5);
+    assert(c.real() == -4.5);
+    assert(c.imag() == -5.5);
+
+    test_constexpr<T> ();
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_constexpr<int> ();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_divide_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_divide_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_divide_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_divide_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,159 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   operator/(const complex<T>& lhs, const complex<T>& rhs);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& lhs, const std::complex<T>& rhs, std::complex<T> x)
+{
+    assert(lhs / rhs == x);
+}
+
+template <class T>
+void
+test()
+{
+    std::complex<T> lhs(-4.0, 7.5);
+    std::complex<T> rhs(1.5, 2.5);
+    std::complex<T>   x(1.5, 2.5);
+    test(lhs, rhs, x);
+}
+
+void test_edges()
+{
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        for (unsigned j = 0; j < N; ++j)
+        {
+            std::complex<double> r = x[i] / x[j];
+            switch (classify(x[i]))
+            {
+            case zero:
+                switch (classify(x[j]))
+                {
+                case zero:
+                    assert(classify(r) == NaN);
+                    break;
+                case non_zero:
+                    assert(classify(r) == zero);
+                    break;
+                case inf:
+                    assert(classify(r) == zero);
+                    break;
+                case NaN:
+                    assert(classify(r) == NaN);
+                    break;
+                case non_zero_nan:
+                    assert(classify(r) == NaN);
+                    break;
+                }
+                break;
+            case non_zero:
+                switch (classify(x[j]))
+                {
+                case zero:
+                    assert(classify(r) == inf);
+                    break;
+                case non_zero:
+                    assert(classify(r) == non_zero);
+                    break;
+                case inf:
+                    assert(classify(r) == zero);
+                    break;
+                case NaN:
+                    assert(classify(r) == NaN);
+                    break;
+                case non_zero_nan:
+                    assert(classify(r) == NaN);
+                    break;
+                }
+                break;
+            case inf:
+                switch (classify(x[j]))
+                {
+                case zero:
+                    assert(classify(r) == inf);
+                    break;
+                case non_zero:
+                    assert(classify(r) == inf);
+                    break;
+                case inf:
+                    assert(classify(r) == NaN);
+                    break;
+                case NaN:
+                    assert(classify(r) == NaN);
+                    break;
+                case non_zero_nan:
+                    assert(classify(r) == NaN);
+                    break;
+                }
+                break;
+            case NaN:
+                switch (classify(x[j]))
+                {
+                case zero:
+                    assert(classify(r) == NaN);
+                    break;
+                case non_zero:
+                    assert(classify(r) == NaN);
+                    break;
+                case inf:
+                    assert(classify(r) == NaN);
+                    break;
+                case NaN:
+                    assert(classify(r) == NaN);
+                    break;
+                case non_zero_nan:
+                    assert(classify(r) == NaN);
+                    break;
+                }
+                break;
+            case non_zero_nan:
+                switch (classify(x[j]))
+                {
+                case zero:
+                    assert(classify(r) == inf);
+                    break;
+                case non_zero:
+                    assert(classify(r) == NaN);
+                    break;
+                case inf:
+                    assert(classify(r) == NaN);
+                    break;
+                case NaN:
+                    assert(classify(r) == NaN);
+                    break;
+                case non_zero_nan:
+                    assert(classify(r) == NaN);
+                    break;
+                }
+                break;
+            }
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_divide_scalar.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_divide_scalar.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_divide_scalar.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_divide_scalar.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   operator/(const complex<T>& lhs, const T& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test(const std::complex<T>& lhs, const T& rhs, std::complex<T> x)
+{
+    assert(lhs / rhs == x);
+}
+
+template <class T>
+void
+test()
+{
+    std::complex<T> lhs(-4.0, 7.5);
+    T rhs(2);
+    std::complex<T>   x(-2, 3.75);
+    test(lhs, rhs, x);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_equals_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_equals_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_equals_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_equals_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   bool
+//   operator==(const complex<T>& lhs, const complex<T>& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test_constexpr()
+{
+#if _LIBCPP_STD_VER > 11
+    {
+    constexpr std::complex<T> lhs(1.5,  2.5);
+    constexpr std::complex<T> rhs(1.5, -2.5);
+    static_assert( !(lhs == rhs), "");
+    }
+    {
+    constexpr std::complex<T> lhs(1.5, 2.5);
+    constexpr std::complex<T> rhs(1.5, 2.5);
+    static_assert(lhs == rhs, "");
+    }
+#endif
+}
+
+template <class T>
+void
+test()
+{
+    {
+    std::complex<T> lhs(1.5,  2.5);
+    std::complex<T> rhs(1.5, -2.5);
+    assert( !(lhs == rhs));
+    }
+    {
+    std::complex<T> lhs(1.5, 2.5);
+    std::complex<T> rhs(1.5, 2.5);
+    assert(lhs == rhs);
+    }
+    test_constexpr<T> ();
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+//    test_constexpr<int> ();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_equals_scalar.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_equals_scalar.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_equals_scalar.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_equals_scalar.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   bool
+//   operator==(const complex<T>& lhs, const T& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test_constexpr()
+{
+#if _LIBCPP_STD_VER > 11
+    {
+    constexpr std::complex<T> lhs(1.5, 2.5);
+    constexpr T rhs(-2.5);
+    static_assert(!(lhs == rhs), "");
+    }
+    {
+    constexpr std::complex<T> lhs(1.5, 0);
+    constexpr T rhs(-2.5);
+    static_assert(!(lhs == rhs), "");
+    }
+    {
+    constexpr std::complex<T> lhs(1.5, 2.5);
+    constexpr T rhs(1.5);
+    static_assert(!(lhs == rhs), "");
+    }
+    {
+    constexpr std::complex<T> lhs(1.5, 0);
+    constexpr T rhs(1.5);
+    static_assert( (lhs == rhs), "");
+    }
+#endif
+}
+
+template <class T>
+void
+test()
+{
+    {
+    std::complex<T> lhs(1.5,  2.5);
+    T rhs(-2.5);
+    assert(!(lhs == rhs));
+    }
+    {
+    std::complex<T> lhs(1.5, 0);
+    T rhs(-2.5);
+    assert(!(lhs == rhs));
+    }
+    {
+    std::complex<T> lhs(1.5, 2.5);
+    T rhs(1.5);
+    assert(!(lhs == rhs));
+    }
+    {
+    std::complex<T> lhs(1.5, 0);
+    T rhs(1.5);
+    assert( (lhs == rhs));
+    }
+
+    test_constexpr<T> ();
+    }
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+//     test_constexpr<int> ();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_minus_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_minus_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_minus_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_minus_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   operator-(const complex<T>& lhs, const complex<T>& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test(const std::complex<T>& lhs, const std::complex<T>& rhs, std::complex<T> x)
+{
+    assert(lhs - rhs == x);
+}
+
+template <class T>
+void
+test()
+{
+    {
+    std::complex<T> lhs(1.5, 2.5);
+    std::complex<T> rhs(3.5, 4.5);
+    std::complex<T>   x(-2.0, -2.0);
+    test(lhs, rhs, x);
+    }
+    {
+    std::complex<T> lhs(1.5, -2.5);
+    std::complex<T> rhs(-3.5, 4.5);
+    std::complex<T>   x(5.0, -7.0);
+    test(lhs, rhs, x);
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_minus_scalar.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_minus_scalar.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_minus_scalar.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_minus_scalar.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   operator-(const complex<T>& lhs, const T& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test(const std::complex<T>& lhs, const T& rhs, std::complex<T> x)
+{
+    assert(lhs - rhs == x);
+}
+
+template <class T>
+void
+test()
+{
+    {
+    std::complex<T> lhs(1.5, 2.5);
+    T rhs(3.5);
+    std::complex<T>   x(-2.0, 2.5);
+    test(lhs, rhs, x);
+    }
+    {
+    std::complex<T> lhs(1.5, -2.5);
+    T rhs(-3.5);
+    std::complex<T>   x(5.0, -2.5);
+    test(lhs, rhs, x);
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_not_equals_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_not_equals_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_not_equals_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_not_equals_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   bool
+//   operator!=(const complex<T>& lhs, const complex<T>& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test_constexpr()
+{
+#if _LIBCPP_STD_VER > 11
+    {
+    constexpr std::complex<T> lhs(1.5,  2.5);
+    constexpr std::complex<T> rhs(1.5, -2.5);
+    static_assert(lhs != rhs, "");
+    }
+    {
+    constexpr std::complex<T> lhs(1.5, 2.5);
+    constexpr std::complex<T> rhs(1.5, 2.5);
+    static_assert(!(lhs != rhs), "" );
+    }
+#endif
+}
+
+
+template <class T>
+void
+test()
+{
+    {
+    std::complex<T> lhs(1.5,  2.5);
+    std::complex<T> rhs(1.5, -2.5);
+    assert(lhs != rhs);
+    }
+    {
+    std::complex<T> lhs(1.5, 2.5);
+    std::complex<T> rhs(1.5, 2.5);
+    assert(!(lhs != rhs));
+    }
+
+    test_constexpr<T> ();
+    }
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+//   test_constexpr<int> ();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_not_equals_scalar.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_not_equals_scalar.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_not_equals_scalar.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_not_equals_scalar.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   bool
+//   operator!=(const complex<T>& lhs, const T& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test_constexpr()
+{
+#if _LIBCPP_STD_VER > 11
+    {
+    constexpr std::complex<T> lhs(1.5,  2.5);
+    constexpr T rhs(-2.5);
+    static_assert(lhs != rhs, "");
+    }
+    {
+    constexpr std::complex<T> lhs(1.5,  0);
+    constexpr T rhs(-2.5);
+    static_assert(lhs != rhs, "");
+    }
+    {
+    constexpr std::complex<T> lhs(1.5, 2.5);
+    constexpr T rhs(1.5);
+    static_assert(lhs != rhs, "");
+    }
+    {
+    constexpr std::complex<T> lhs(1.5, 0);
+    constexpr T rhs(1.5);
+    static_assert( !(lhs != rhs), "");
+    }
+#endif
+}
+
+template <class T>
+void
+test()
+{
+    {
+    std::complex<T> lhs(1.5,  2.5);
+    T rhs(-2.5);
+    assert(lhs != rhs);
+    }
+    {
+    std::complex<T> lhs(1.5,  0);
+    T rhs(-2.5);
+    assert(lhs != rhs);
+    }
+    {
+    std::complex<T> lhs(1.5, 2.5);
+    T rhs(1.5);
+    assert(lhs != rhs);
+    }
+    {
+    std::complex<T> lhs(1.5, 0);
+    T rhs(1.5);
+    assert( !(lhs != rhs));
+    }
+
+    test_constexpr<T> ();
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+//     test_constexpr<int> ();
+    }

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_plus_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_plus_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_plus_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_plus_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   operator+(const complex<T>& lhs, const complex<T>& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test(const std::complex<T>& lhs, const std::complex<T>& rhs, std::complex<T> x)
+{
+    assert(lhs + rhs == x);
+}
+
+template <class T>
+void
+test()
+{
+    {
+    std::complex<T> lhs(1.5, 2.5);
+    std::complex<T> rhs(3.5, 4.5);
+    std::complex<T>   x(5.0, 7.0);
+    test(lhs, rhs, x);
+    }
+    {
+    std::complex<T> lhs(1.5, -2.5);
+    std::complex<T> rhs(-3.5, 4.5);
+    std::complex<T>   x(-2.0, 2.0);
+    test(lhs, rhs, x);
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_plus_scalar.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_plus_scalar.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_plus_scalar.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_plus_scalar.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   operator+(const complex<T>& lhs, const T& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test(const std::complex<T>& lhs, const T& rhs, std::complex<T> x)
+{
+    assert(lhs + rhs == x);
+}
+
+template <class T>
+void
+test()
+{
+    {
+    std::complex<T> lhs(1.5, 2.5);
+    T rhs(3.5);
+    std::complex<T>   x(5.0, 2.5);
+    test(lhs, rhs, x);
+    }
+    {
+    std::complex<T> lhs(1.5, -2.5);
+    T rhs(-3.5);
+    std::complex<T>   x(-2.0, -2.5);
+    test(lhs, rhs, x);
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_times_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_times_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_times_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_times_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,161 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   operator*(const complex<T>& lhs, const complex<T>& rhs);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& lhs, const std::complex<T>& rhs, std::complex<T> x)
+{
+    assert(lhs * rhs == x);
+}
+
+template <class T>
+void
+test()
+{
+    std::complex<T> lhs(1.5, 2.5);
+    std::complex<T> rhs(1.5, 2.5);
+    std::complex<T>   x(-4.0, 7.5);
+    test(lhs, rhs, x);
+}
+
+// test edges
+
+void test_edges()
+{
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        for (unsigned j = 0; j < N; ++j)
+        {
+            std::complex<double> r = x[i] * x[j];
+            switch (classify(x[i]))
+            {
+            case zero:
+                switch (classify(x[j]))
+                {
+                case zero:
+                    assert(classify(r) == zero);
+                    break;
+                case non_zero:
+                    assert(classify(r) == zero);
+                    break;
+                case inf:
+                    assert(classify(r) == NaN);
+                    break;
+                case NaN:
+                    assert(classify(r) == NaN);
+                    break;
+                case non_zero_nan:
+                    assert(classify(r) == NaN);
+                    break;
+                }
+                break;
+            case non_zero:
+                switch (classify(x[j]))
+                {
+                case zero:
+                    assert(classify(r) == zero);
+                    break;
+                case non_zero:
+                    assert(classify(r) == non_zero);
+                    break;
+                case inf:
+                    assert(classify(r) == inf);
+                    break;
+                case NaN:
+                    assert(classify(r) == NaN);
+                    break;
+                case non_zero_nan:
+                    assert(classify(r) == NaN);
+                    break;
+                }
+                break;
+            case inf:
+                switch (classify(x[j]))
+                {
+                case zero:
+                    assert(classify(r) == NaN);
+                    break;
+                case non_zero:
+                    assert(classify(r) == inf);
+                    break;
+                case inf:
+                    assert(classify(r) == inf);
+                    break;
+                case NaN:
+                    assert(classify(r) == NaN);
+                    break;
+                case non_zero_nan:
+                    assert(classify(r) == inf);
+                    break;
+                }
+                break;
+            case NaN:
+                switch (classify(x[j]))
+                {
+                case zero:
+                    assert(classify(r) == NaN);
+                    break;
+                case non_zero:
+                    assert(classify(r) == NaN);
+                    break;
+                case inf:
+                    assert(classify(r) == NaN);
+                    break;
+                case NaN:
+                    assert(classify(r) == NaN);
+                    break;
+                case non_zero_nan:
+                    assert(classify(r) == NaN);
+                    break;
+                }
+                break;
+            case non_zero_nan:
+                switch (classify(x[j]))
+                {
+                case zero:
+                    assert(classify(r) == NaN);
+                    break;
+                case non_zero:
+                    assert(classify(r) == NaN);
+                    break;
+                case inf:
+                    assert(classify(r) == inf);
+                    break;
+                case NaN:
+                    assert(classify(r) == NaN);
+                    break;
+                case non_zero_nan:
+                    assert(classify(r) == NaN);
+                    break;
+                }
+                break;
+            }
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_times_scalar.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_times_scalar.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_times_scalar.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/complex_times_scalar.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   operator*(const complex<T>& lhs, const T& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test(const std::complex<T>& lhs, const T& rhs, std::complex<T> x)
+{
+    assert(lhs * rhs == x);
+}
+
+template <class T>
+void
+test()
+{
+    std::complex<T> lhs(1.5, 2.5);
+    T rhs(1.5);
+    std::complex<T>   x(2.25, 3.75);
+    test(lhs, rhs, x);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_divide_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_divide_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_divide_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_divide_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   operator/(const T& lhs, const complex<T>& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test(const T& lhs, const std::complex<T>& rhs, std::complex<T> x)
+{
+    assert(lhs / rhs == x);
+}
+
+template <class T>
+void
+test()
+{
+    T lhs(-8.5);
+    std::complex<T> rhs(1.5, 2.5);
+    std::complex<T>   x(-1.5, 2.5);
+    test(lhs, rhs, x);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_equals_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_equals_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_equals_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_equals_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   bool
+//   operator==(const T& lhs, const complex<T>& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test_constexpr()
+{
+#if _LIBCPP_STD_VER > 11
+    {
+    constexpr T lhs(-2.5);
+    constexpr std::complex<T> rhs(1.5,  2.5);
+    static_assert(!(lhs == rhs), "");
+    }
+    {
+    constexpr T lhs(-2.5);
+    constexpr std::complex<T> rhs(1.5,  0);
+    static_assert(!(lhs == rhs), "");
+    }
+    {
+    constexpr T lhs(1.5);
+    constexpr std::complex<T> rhs(1.5, 2.5);
+    static_assert(!(lhs == rhs), "");
+    }
+    {
+    constexpr T lhs(1.5);
+    constexpr std::complex<T> rhs(1.5, 0);
+    static_assert(lhs == rhs, "");
+    }
+#endif
+}
+
+template <class T>
+void
+test()
+{
+    {
+    T lhs(-2.5);
+    std::complex<T> rhs(1.5,  2.5);
+    assert(!(lhs == rhs));
+    }
+    {
+    T lhs(-2.5);
+    std::complex<T> rhs(1.5,  0);
+    assert(!(lhs == rhs));
+    }
+    {
+    T lhs(1.5);
+    std::complex<T> rhs(1.5, 2.5);
+    assert(!(lhs == rhs));
+    }
+    {
+    T lhs(1.5);
+    std::complex<T> rhs(1.5, 0);
+    assert(lhs == rhs);
+    }
+
+    test_constexpr<T> ();
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+//     test_constexpr<int>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_minus_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_minus_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_minus_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_minus_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   operator-(const T& lhs, const complex<T>& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test(const T& lhs, const std::complex<T>& rhs, std::complex<T> x)
+{
+    assert(lhs - rhs == x);
+}
+
+template <class T>
+void
+test()
+{
+    {
+    T lhs(1.5);
+    std::complex<T> rhs(3.5, 4.5);
+    std::complex<T>   x(-2.0, -4.5);
+    test(lhs, rhs, x);
+    }
+    {
+    T lhs(1.5);
+    std::complex<T> rhs(-3.5, 4.5);
+    std::complex<T>   x(5.0, -4.5);
+    test(lhs, rhs, x);
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_not_equals_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_not_equals_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_not_equals_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_not_equals_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   bool
+//   operator!=(const T& lhs, const complex<T>& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test_constexpr()
+{
+#if _LIBCPP_STD_VER > 11
+    {
+    constexpr T lhs(-2.5);
+    constexpr std::complex<T> rhs(1.5,  2.5);
+    static_assert (lhs != rhs, "");
+    }
+    {
+    constexpr T lhs(-2.5);
+    constexpr std::complex<T> rhs(1.5,  0);
+    static_assert (lhs != rhs, "");
+    }
+    {
+    constexpr T lhs(1.5);
+    constexpr std::complex<T> rhs(1.5, 2.5);
+    static_assert (lhs != rhs, "");
+    }
+    {
+    constexpr T lhs(1.5);
+    constexpr std::complex<T> rhs(1.5, 0);
+    static_assert (!(lhs != rhs), "");
+    }
+#endif
+}
+
+template <class T>
+void
+test()
+{
+    {
+    T lhs(-2.5);
+    std::complex<T> rhs(1.5,  2.5);
+    assert (lhs != rhs);
+    }
+    {
+    T lhs(-2.5);
+    std::complex<T> rhs(1.5,  0);
+    assert (lhs != rhs);
+    }
+    {
+    T lhs(1.5);
+    std::complex<T> rhs(1.5, 2.5);
+    assert (lhs != rhs);
+    }
+    {
+    T lhs(1.5);
+    std::complex<T> rhs(1.5, 0);
+    assert (!(lhs != rhs));
+    }
+
+    test_constexpr<T> ();
+    }
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+//     test_constexpr<int>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_plus_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_plus_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_plus_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_plus_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   operator+(const T& lhs, const complex<T>& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test(const T& lhs, const std::complex<T>& rhs, std::complex<T> x)
+{
+    assert(lhs + rhs == x);
+}
+
+template <class T>
+void
+test()
+{
+    {
+    T lhs(1.5);
+    std::complex<T> rhs(3.5, 4.5);
+    std::complex<T>   x(5.0, 4.5);
+    test(lhs, rhs, x);
+    }
+    {
+    T lhs(1.5);
+    std::complex<T> rhs(-3.5, 4.5);
+    std::complex<T>   x(-2.0, 4.5);
+    test(lhs, rhs, x);
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_times_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_times_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_times_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/scalar_times_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   operator*(const T& lhs, const complex<T>& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test(const T& lhs, const std::complex<T>& rhs, std::complex<T> x)
+{
+    assert(lhs * rhs == x);
+}
+
+template <class T>
+void
+test()
+{
+    T lhs(1.5);
+    std::complex<T> rhs(1.5, 2.5);
+    std::complex<T>   x(2.25, 3.75);
+    test(lhs, rhs, x);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,99 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T, class charT, class traits>
+//   basic_istream<charT, traits>&
+//   operator>>(basic_istream<charT, traits>& is, complex<T>& x);
+
+#include <complex>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::istringstream is("5");
+        std::complex<double> c;
+        is >> c;
+        assert(c == std::complex<double>(5, 0));
+        assert(is.eof());
+    }
+    {
+        std::istringstream is(" 5 ");
+        std::complex<double> c;
+        is >> c;
+        assert(c == std::complex<double>(5, 0));
+        assert(is.good());
+    }
+    {
+        std::istringstream is(" 5, ");
+        std::complex<double> c;
+        is >> c;
+        assert(c == std::complex<double>(5, 0));
+        assert(is.good());
+    }
+    {
+        std::istringstream is(" , 5, ");
+        std::complex<double> c;
+        is >> c;
+        assert(c == std::complex<double>(0, 0));
+        assert(is.fail());
+    }
+    {
+        std::istringstream is("5.5 ");
+        std::complex<double> c;
+        is >> c;
+        assert(c == std::complex<double>(5.5, 0));
+        assert(is.good());
+    }
+    {
+        std::istringstream is(" ( 5.5 ) ");
+        std::complex<double> c;
+        is >> c;
+        assert(c == std::complex<double>(5.5, 0));
+        assert(is.good());
+    }
+    {
+        std::istringstream is("  5.5)");
+        std::complex<double> c;
+        is >> c;
+        assert(c == std::complex<double>(5.5, 0));
+        assert(is.good());
+    }
+    {
+        std::istringstream is("(5.5 ");
+        std::complex<double> c;
+        is >> c;
+        assert(c == std::complex<double>(0, 0));
+        assert(is.fail());
+    }
+    {
+        std::istringstream is("(5.5,");
+        std::complex<double> c;
+        is >> c;
+        assert(c == std::complex<double>(0, 0));
+        assert(is.fail());
+    }
+    {
+        std::istringstream is("( -5.5 , -6.5 )");
+        std::complex<double> c;
+        is >> c;
+        assert(c == std::complex<double>(-5.5, -6.5));
+        assert(!is.eof());
+    }
+    {
+        std::istringstream is("(-5.5,-6.5)");
+        std::complex<double> c;
+        is >> c;
+        assert(c == std::complex<double>(-5.5, -6.5));
+        assert(!is.eof());
+    }
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/stream_output.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/stream_output.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/stream_output.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/stream_output.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T, class charT, class traits>
+//   basic_ostream<charT, traits>&
+//   operator<<(basic_ostream<charT, traits>& o, const complex<T>& x);
+
+#include <complex>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    std::complex<double> c(1, 2);
+    std::ostringstream os;
+    os << c;
+    assert(os.str() == "(1,2)");
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/unary_minus.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/unary_minus.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/unary_minus.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/unary_minus.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   operator-(const complex<T>& lhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    std::complex<T> z(1.5, 2.5);
+    assert(z.real() == 1.5);
+    assert(z.imag() == 2.5);
+    std::complex<T> c = -z;
+    assert(c.real() == -1.5);
+    assert(c.imag() == -2.5);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.ops/unary_plus.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.ops/unary_plus.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.ops/unary_plus.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.ops/unary_plus.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   operator+(const complex<T>&);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    std::complex<T> z(1.5, 2.5);
+    assert(z.real() == 1.5);
+    assert(z.imag() == 2.5);
+    std::complex<T> c = +z;
+    assert(c.real() == 1.5);
+    assert(c.imag() == 2.5);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.special/double_float_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.special/double_float_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.special/double_float_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.special/double_float_explicit.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<> class complex<double>
+// {
+// public:
+//     constexpr complex(const complex<float>&);
+// };
+
+#include <complex>
+#include <cassert>
+
+int main()
+{
+    {
+    const std::complex<float> cd(2.5, 3.5);
+    std::complex<double> cf(cd);
+    assert(cf.real() == cd.real());
+    assert(cf.imag() == cd.imag());
+    }
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+    {
+    constexpr std::complex<float> cd(2.5, 3.5);
+    constexpr std::complex<double> cf(cd);
+    static_assert(cf.real() == cd.real(), "");
+    static_assert(cf.imag() == cd.imag(), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.special/double_float_implicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.special/double_float_implicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.special/double_float_implicit.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.special/double_float_implicit.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<> class complex<double>
+// {
+// public:
+//     constexpr complex(const complex<float>&);
+// };
+
+#include <complex>
+#include <cassert>
+
+int main()
+{
+    {
+    const std::complex<float> cd(2.5, 3.5);
+    std::complex<double> cf = cd;
+    assert(cf.real() == cd.real());
+    assert(cf.imag() == cd.imag());
+    }
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+    {
+    constexpr std::complex<float> cd(2.5, 3.5);
+    constexpr std::complex<double> cf = cd;
+    static_assert(cf.real() == cd.real(), "");
+    static_assert(cf.imag() == cd.imag(), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.special/double_long_double_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.special/double_long_double_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.special/double_long_double_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.special/double_long_double_explicit.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<> class complex<double>
+// {
+// public:
+//     explicit constexpr complex(const complex<long double>&);
+// };
+
+#include <complex>
+#include <cassert>
+
+int main()
+{
+    {
+    const std::complex<long double> cd(2.5, 3.5);
+    std::complex<double> cf(cd);
+    assert(cf.real() == cd.real());
+    assert(cf.imag() == cd.imag());
+    }
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+    {
+    constexpr std::complex<long double> cd(2.5, 3.5);
+    constexpr std::complex<double> cf(cd);
+    static_assert(cf.real() == cd.real(), "");
+    static_assert(cf.imag() == cd.imag(), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.special/double_long_double_implicit.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.special/double_long_double_implicit.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.special/double_long_double_implicit.fail.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.special/double_long_double_implicit.fail.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<> class complex<double>
+// {
+// public:
+//     explicit constexpr complex(const complex<long double>&);
+// };
+
+#include <complex>
+#include <cassert>
+
+int main()
+{
+    const std::complex<long double> cd(2.5, 3.5);
+    std::complex<double> cf = cd;
+    assert(cf.real() == cd.real());
+    assert(cf.imag() == cd.imag());
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.special/float_double_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.special/float_double_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.special/float_double_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.special/float_double_explicit.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<> class complex<float>
+// {
+// public:
+//     explicit constexpr complex(const complex<double>&);
+// };
+
+#include <complex>
+#include <cassert>
+
+int main()
+{
+    {
+    const std::complex<double> cd(2.5, 3.5);
+    std::complex<float> cf(cd);
+    assert(cf.real() == cd.real());
+    assert(cf.imag() == cd.imag());
+    }
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+    {
+    constexpr std::complex<double> cd(2.5, 3.5);
+    constexpr std::complex<float> cf(cd);
+    static_assert(cf.real() == cd.real(), "");
+    static_assert(cf.imag() == cd.imag(), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.special/float_double_implicit.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.special/float_double_implicit.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.special/float_double_implicit.fail.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.special/float_double_implicit.fail.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<> class complex<float>
+// {
+// public:
+//     explicit constexpr complex(const complex<double>&);
+// };
+
+#include <complex>
+#include <cassert>
+
+int main()
+{
+    const std::complex<double> cd(2.5, 3.5);
+    std::complex<float> cf = cd;
+    assert(cf.real() == cd.real());
+    assert(cf.imag() == cd.imag());
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.special/float_long_double_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.special/float_long_double_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.special/float_long_double_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.special/float_long_double_explicit.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<> class complex<float>
+// {
+// public:
+//     explicit constexpr complex(const complex<long double>&);
+// };
+
+#include <complex>
+#include <cassert>
+
+int main()
+{
+    {
+    const std::complex<long double> cd(2.5, 3.5);
+    std::complex<float> cf(cd);
+    assert(cf.real() == cd.real());
+    assert(cf.imag() == cd.imag());
+    }
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+    {
+    constexpr std::complex<long double> cd(2.5, 3.5);
+    constexpr std::complex<float> cf(cd);
+    static_assert(cf.real() == cd.real(), "");
+    static_assert(cf.imag() == cd.imag(), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.special/float_long_double_implicit.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.special/float_long_double_implicit.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.special/float_long_double_implicit.fail.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.special/float_long_double_implicit.fail.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<> class complex<float>
+// {
+// public:
+//     explicit constexpr complex(const complex<long double>&);
+// };
+
+#include <complex>
+#include <cassert>
+
+int main()
+{
+    const std::complex<long double> cd(2.5, 3.5);
+    std::complex<float> cf = cd;
+    assert(cf.real() == cd.real());
+    assert(cf.imag() == cd.imag());
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.special/long_double_double_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.special/long_double_double_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.special/long_double_double_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.special/long_double_double_explicit.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<> class complex<long double>
+// {
+// public:
+//     constexpr complex(const complex<double>&);
+// };
+
+#include <complex>
+#include <cassert>
+
+int main()
+{
+    {
+    const std::complex<double> cd(2.5, 3.5);
+    std::complex<long double> cf(cd);
+    assert(cf.real() == cd.real());
+    assert(cf.imag() == cd.imag());
+    }
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+    {
+    constexpr std::complex<double> cd(2.5, 3.5);
+    constexpr std::complex<long double> cf(cd);
+    static_assert(cf.real() == cd.real(), "");
+    static_assert(cf.imag() == cd.imag(), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.special/long_double_double_implicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.special/long_double_double_implicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.special/long_double_double_implicit.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.special/long_double_double_implicit.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<> class complex<long double>
+// {
+// public:
+//     constexpr complex(const complex<double>&);
+// };
+
+#include <complex>
+#include <cassert>
+
+int main()
+{
+    {
+    const std::complex<double> cd(2.5, 3.5);
+    std::complex<long double> cf = cd;
+    assert(cf.real() == cd.real());
+    assert(cf.imag() == cd.imag());
+    }
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+    {
+    constexpr std::complex<double> cd(2.5, 3.5);
+    constexpr std::complex<long double> cf = cd;
+    static_assert(cf.real() == cd.real(), "");
+    static_assert(cf.imag() == cd.imag(), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.special/long_double_float_explicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.special/long_double_float_explicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.special/long_double_float_explicit.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.special/long_double_float_explicit.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<> class complex<long double>
+// {
+// public:
+//     constexpr complex(const complex<float>&);
+// };
+
+#include <complex>
+#include <cassert>
+
+int main()
+{
+    {
+    const std::complex<float> cd(2.5, 3.5);
+    std::complex<long double> cf(cd);
+    assert(cf.real() == cd.real());
+    assert(cf.imag() == cd.imag());
+    }
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+    {
+    constexpr std::complex<float> cd(2.5, 3.5);
+    constexpr std::complex<long double> cf(cd);
+    static_assert(cf.real() == cd.real(), "");
+    static_assert(cf.imag() == cd.imag(), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.special/long_double_float_implicit.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.special/long_double_float_implicit.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.special/long_double_float_implicit.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.special/long_double_float_implicit.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<> class complex<long double>
+// {
+// public:
+//     constexpr complex(const complex<float>&);
+// };
+
+#include <complex>
+#include <cassert>
+
+int main()
+{
+    {
+    const std::complex<float> cd(2.5, 3.5);
+    std::complex<long double> cf = cd;
+    assert(cf.real() == cd.real());
+    assert(cf.imag() == cd.imag());
+    }
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+    {
+    constexpr std::complex<float> cd(2.5, 3.5);
+    constexpr std::complex<long double> cf = cd;
+    static_assert(cf.real() == cd.real(), "");
+    static_assert(cf.imag() == cd.imag(), "");
+    }
+#endif
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.synopsis/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.synopsis/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.synopsis/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.synopsis/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/acos.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,140 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   acos(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& c, std::complex<T> x)
+{
+    assert(acos(c) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(INFINITY, 1), std::complex<T>(0, -INFINITY));
+}
+
+void test_edges()
+{
+    typedef std::complex<double> C;
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = acos(x[i]);
+        if (x[i].real() == 0 && x[i].imag() == 0)
+        {
+            is_about(r.real(), pi/2);
+            assert(r.imag() == 0);
+            assert(std::signbit(x[i].imag()) != std::signbit(r.imag()));
+        }
+        else if (x[i].real() == 0 && std::isnan(x[i].imag()))
+        {
+            is_about(r.real(), pi/2);
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            is_about(r.real(), pi/2);
+            assert(std::isinf(r.imag()));
+            assert(std::signbit(x[i].imag()) != std::signbit(r.imag()));
+        }
+        else if (std::isfinite(x[i].real()) && x[i].real() != 0 && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isfinite(x[i].imag()))
+        {
+            is_about(r.real(), pi);
+            assert(std::isinf(r.imag()));
+            assert(std::signbit(x[i].imag()) != std::signbit(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isfinite(x[i].imag()))
+        {
+            assert(r.real() == 0);
+            assert(!std::signbit(r.real()));
+            assert(std::isinf(r.imag()));
+            assert(std::signbit(x[i].imag()) != std::signbit(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isinf(x[i].imag()))
+        {
+            is_about(r.real(), 0.75 * pi);
+            assert(std::isinf(r.imag()));
+            assert(std::signbit(x[i].imag()) != std::signbit(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isinf(x[i].imag()))
+        {
+            is_about(r.real(), 0.25 * pi);
+            assert(std::isinf(r.imag()));
+            assert(std::signbit(x[i].imag()) != std::signbit(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isinf(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isfinite(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isinf(r.imag()));
+            assert(std::signbit(x[i].imag()) != std::signbit(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (!std::signbit(x[i].real()) && !std::signbit(x[i].imag()))
+        {
+            assert(!std::signbit(r.real()));
+            assert( std::signbit(r.imag()));
+        }
+        else if (std::signbit(x[i].real()) && !std::signbit(x[i].imag()))
+        {
+            assert(!std::signbit(r.real()));
+            assert( std::signbit(r.imag()));
+        }
+        else if (std::signbit(x[i].real()) && std::signbit(x[i].imag()))
+        {
+            assert(!std::signbit(r.real()));
+            assert(!std::signbit(r.imag()));
+        }
+        else if (!std::signbit(x[i].real()) && std::signbit(x[i].imag()))
+        {
+            assert(!std::signbit(r.real()));
+            assert(!std::signbit(r.imag()));
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,142 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   acosh(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& c, std::complex<T> x)
+{
+    assert(acosh(c) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(INFINITY, 1), std::complex<T>(INFINITY, 0));
+}
+
+void test_edges()
+{
+    typedef std::complex<double> C;
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = acosh(x[i]);
+        if (x[i].real() == 0 && x[i].imag() == 0)
+        {
+            assert(!std::signbit(r.real()));
+            if (std::signbit(x[i].imag()))
+                is_about(r.imag(), -pi/2);
+            else
+                is_about(r.imag(),  pi/2);
+        }
+        else if (x[i].real() == 1 && x[i].imag() == 0)
+        {
+            assert(r.real() == 0);
+            assert(!std::signbit(r.real()));
+            assert(r.imag() == 0);
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+        else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(r.real() > 0);
+            if (std::signbit(x[i].imag()))
+                is_about(r.imag(), -pi/2);
+            else
+                is_about(r.imag(),  pi/2);
+        }
+        else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isfinite(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(r.real() > 0);
+            if (std::signbit(x[i].imag()))
+                is_about(r.imag(), -pi);
+            else
+                is_about(r.imag(),  pi);
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isfinite(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(r.real() > 0);
+            assert(r.imag() == 0);
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isinf(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(r.real() > 0);
+            if (std::signbit(x[i].imag()))
+                is_about(r.imag(), -0.75 * pi);
+            else
+                is_about(r.imag(),  0.75 * pi);
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isinf(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(r.real() > 0);
+            if (std::signbit(x[i].imag()))
+                is_about(r.imag(), -0.25 * pi);
+            else
+                is_about(r.imag(),  0.25 * pi);
+        }
+        else if (std::isinf(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(r.real() > 0);
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isfinite(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(r.real() > 0);
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else
+        {
+            assert(!std::signbit(r.real()));
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/asin.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,120 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   asin(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& c, std::complex<T> x)
+{
+    assert(asin(c) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(0, 0), std::complex<T>(0, 0));
+}
+
+void test_edges()
+{
+    typedef std::complex<double> C;
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = asin(x[i]);
+        if (x[i].real() == 0 && x[i].imag() == 0)
+        {
+            assert(std::signbit(r.real()) == std::signbit(x[i].real()));
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+        else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(r.real() == 0);
+            assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+            assert(std::isinf(r.imag()));
+            assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+        }
+        else if ( x[i].real() == 0 && std::isnan(x[i].imag()))
+        {
+            assert(r.real() == 0);
+            assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && std::isfinite(x[i].imag()))
+        {
+            if (x[i].real() > 0)
+                is_about(r.real(),  pi/2);
+            else
+                is_about(r.real(), - pi/2);
+            assert(std::isinf(r.imag()));
+            assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            if (std::signbit(x[i].real()))
+                is_about(r.real(), -pi/4);
+            else
+                is_about(r.real(),  pi/4);
+            assert(std::isinf(r.imag()));
+            assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isinf(r.imag()));
+            assert(std::signbit(x[i].real()) != std::signbit(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isfinite(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+            assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isinf(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else
+        {
+            assert(std::signbit(r.real()) == std::signbit(x[i].real()));
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,119 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   asinh(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& c, std::complex<T> x)
+{
+    assert(asinh(c) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(0, 0), std::complex<T>(0, 0));
+}
+
+void test_edges()
+{
+    typedef std::complex<double> C;
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = asinh(x[i]);
+        if (x[i].real() == 0 && x[i].imag() == 0)
+        {
+            assert(std::signbit(r.real()) == std::signbit(x[i].real()));
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+        else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+            if (std::signbit(x[i].imag()))
+                is_about(r.imag(), -pi/2);
+            else
+                is_about(r.imag(),  pi/2);
+        }
+        else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && std::isfinite(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+            assert(r.imag() == 0);
+            assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+            if (std::signbit(x[i].imag()))
+                is_about(r.imag(), -pi/4);
+            else
+                is_about(r.imag(),  pi/4);
+        }
+        else if (std::isinf(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && x[i].imag() == 0)
+        {
+            assert(std::isnan(r.real()));
+            assert(r.imag() == 0);
+            assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isfinite(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else
+        {
+            assert(std::signbit(r.real()) == std::signbit(x[i].real()));
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/atan.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/atan.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/atan.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/atan.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   atan(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& c, std::complex<T> x)
+{
+    assert(atan(c) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(0, 0), std::complex<T>(0, 0));
+}
+
+void test_edges()
+{
+    typedef std::complex<double> C;
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = atan(x[i]);
+        std::complex<double> t1(-imag(x[i]), real(x[i]));
+        std::complex<double> t2 = atanh(t1);
+        std::complex<double> z(imag(t2), -real(t2));
+        if (std::isnan(real(r)))
+            assert(std::isnan(real(z)));
+        else
+        {
+            assert(real(r) == real(z));
+            assert(std::signbit(real(r)) == std::signbit(real(z)));
+        }
+        if (std::isnan(imag(r)))
+            assert(std::isnan(imag(z)));
+        else
+        {
+            assert(imag(r) == imag(z));
+            assert(std::signbit(imag(r)) == std::signbit(imag(z)));
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/atanh.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,132 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   atanh(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& c, std::complex<T> x)
+{
+    assert(atanh(c) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(0, 0), std::complex<T>(0, 0));
+}
+
+void test_edges()
+{
+    typedef std::complex<double> C;
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = atanh(x[i]);
+        if (x[i].real() == 0 && x[i].imag() == 0)
+        {
+            assert(std::signbit(r.real()) == std::signbit(x[i].real()));
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+        else if ( x[i].real() == 0 && std::isnan(x[i].imag()))
+        {
+            assert(r.real() == 0);
+            assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::abs(x[i].real()) == 1 && x[i].imag() == 0)
+        {
+            assert(std::isinf(r.real()));
+            assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+            assert(r.imag() == 0);
+            assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+        }
+        else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(r.real() == 0);
+            assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+            if (x[i].imag() > 0)
+                is_about(r.imag(),  pi/2);
+            else
+                is_about(r.imag(), -pi/2);
+        }
+        else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && std::isfinite(x[i].imag()))
+        {
+            assert(r.real() == 0);
+            assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+            if (std::signbit(x[i].imag()))
+                is_about(r.imag(), -pi/2);
+            else
+                is_about(r.imag(),  pi/2);
+        }
+        else if (std::isinf(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(r.real() == 0);
+            assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+            if (std::signbit(x[i].imag()))
+                is_about(r.imag(), -pi/2);
+            else
+                is_about(r.imag(),  pi/2);
+        }
+        else if (std::isinf(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(r.real() == 0);
+            assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isfinite(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(r.real() == 0);
+            assert(std::signbit(x[i].real()) == std::signbit(r.real()));
+            if (std::signbit(x[i].imag()))
+                is_about(r.imag(), -pi/2);
+            else
+                is_about(r.imag(),  pi/2);
+        }
+        else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else
+        {
+            assert(std::signbit(r.real()) == std::signbit(x[i].real()));
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   cos(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& c, std::complex<T> x)
+{
+    assert(cos(c) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(0, 0), std::complex<T>(1, 0));
+}
+
+void test_edges()
+{
+    typedef std::complex<double> C;
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = cos(x[i]);
+        std::complex<double> t1(-imag(x[i]), real(x[i]));
+        std::complex<double> z = cosh(t1);
+        if (std::isnan(real(r)))
+            assert(std::isnan(real(z)));
+        else
+        {
+            assert(real(r) == real(z));
+            assert(std::signbit(real(r)) == std::signbit(real(z)));
+        }
+        if (std::isnan(imag(r)))
+            assert(std::isnan(imag(z)));
+        else
+        {
+            assert(imag(r) == imag(z));
+            assert(std::signbit(imag(r)) == std::signbit(imag(z)));
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,118 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   cosh(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& c, std::complex<T> x)
+{
+    assert(cosh(c) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(0, 0), std::complex<T>(1, 0));
+}
+
+void test_edges()
+{
+    typedef std::complex<double> C;
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = cosh(x[i]);
+        if (x[i].real() == 0 && x[i].imag() == 0)
+        {
+            assert(r.real() == 1);
+            assert(r.imag() == 0);
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+        else if (x[i].real() == 0 && std::isinf(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(r.imag() == 0);
+        }
+        else if (x[i].real() == 0 && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(r.imag() == 0);
+        }
+        else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && x[i].imag() == 0)
+        {
+            assert(std::isinf(r.real()));
+            assert(!std::signbit(r.real()));
+            assert(r.imag() == 0);
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+        else if (std::isinf(x[i].real()) && std::isfinite(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(std::signbit(r.real()) == std::signbit(cos(x[i].imag())));
+            assert(std::isinf(r.imag()));
+            assert(std::signbit(r.imag()) == std::signbit(x[i].real() * sin(x[i].imag())));
+        }
+        else if (std::isinf(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(r.real() > 0);
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && x[i].imag() == 0)
+        {
+            assert(std::isnan(r.real()));
+            assert(r.imag() == 0);
+        }
+        else if (std::isnan(x[i].real()) && std::isfinite(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/exp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/exp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/exp.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/exp.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,114 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   exp(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& c, std::complex<T> x)
+{
+    assert(exp(c) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(0, 0), std::complex<T>(1, 0));
+}
+
+void test_edges()
+{
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = exp(x[i]);
+        if (x[i].real() == 0 && x[i].imag() == 0)
+        {
+            assert(r.real() == 1.0);
+            assert(r.imag() == 0);
+            assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+        }
+        else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() > 0 && x[i].imag() == 0)
+        {
+            assert(std::isinf(r.real()));
+            assert(r.real() > 0);
+            assert(r.imag() == 0);
+            assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isinf(x[i].imag()))
+        {
+            assert(r.real() == 0);
+            assert(r.imag() == 0);
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isinf(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isnan(x[i].imag()))
+        {
+            assert(r.real() == 0);
+            assert(r.imag() == 0);
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isnan(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && x[i].imag() == 0)
+        {
+            assert(std::isnan(r.real()));
+            assert(r.imag() == 0);
+            assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && x[i].imag() != 0)
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isfinite(x[i].imag()) && std::abs(x[i].imag()) <= 1)
+        {
+            assert(!std::signbit(r.real()));
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/log.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/log.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/log.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/log.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,131 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   log(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& c, std::complex<T> x)
+{
+    assert(log(c) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(0, 0), std::complex<T>(-INFINITY, 0));
+}
+
+void test_edges()
+{
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = log(x[i]);
+        if (x[i].real() == 0 && x[i].imag() == 0)
+        {
+            if (std::signbit(x[i].real()))
+            {
+                assert(std::isinf(r.real()));
+                assert(r.real() < 0);
+                if (std::signbit(x[i].imag()))
+                    is_about(r.imag(), -pi);
+                else
+                    is_about(r.imag(), pi);
+            }
+            else
+            {
+                assert(std::isinf(r.real()));
+                assert(r.real() < 0);
+                assert(r.imag() == 0);
+                assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+            }
+        }
+        else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(r.real() > 0);
+            if (x[i].imag() > 0)
+                is_about(r.imag(), pi/2);
+            else
+                is_about(r.imag(), -pi/2);
+        }
+        else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isfinite(x[i].imag()))
+        {
+            assert(std::isinf(r.real()) && r.real() > 0);
+            if (r.imag() > 0)
+                is_about(r.imag(), pi);
+            else
+                is_about(r.imag(), -pi);
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isfinite(x[i].imag()))
+        {
+            assert(std::isinf(r.real()) && r.real() > 0);
+            assert(r.imag() == 0);
+            assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+        }
+        else if (x[i].real() == 1 && x[i].imag() == 0)
+        {
+            assert(r.real() == 0);
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+        else if (x[i].real() == 0 && x[i].imag() == 1)
+        {
+            assert(r.real() == 0);
+            is_about(r.imag(), pi/2);
+        }
+        else if (x[i].real() == -1 && x[i].imag() == 0)
+        {
+            assert(r.real() == 0);
+            if (std::signbit(x[i].imag()))
+                is_about(r.imag(), -pi);
+            else
+                is_about(r.imag(),  pi);
+        }
+        else if (x[i].real() == 0 && x[i].imag() == -1)
+        {
+            assert(r.real() == 0);
+            is_about(r.imag(), -pi/2);
+        }
+        else if (std::isfinite(x[i].real()) && std::isfinite(x[i].imag()) && abs(x[i]) < 1)
+        {
+            assert( std::signbit(r.real()));
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+        else if (std::isfinite(x[i].real()) && std::isfinite(x[i].imag()) && abs(x[i]) > 1)
+        {
+            assert(!std::signbit(r.real()));
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/log10.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/log10.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/log10.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/log10.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   log10(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& c, std::complex<T> x)
+{
+    assert(log10(c) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(0, 0), std::complex<T>(-INFINITY, 0));
+}
+
+void test_edges()
+{
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = log10(x[i]);
+        std::complex<double> z = log(x[i])/std::log(10);
+        if (std::isnan(real(r)))
+            assert(std::isnan(real(z)));
+        else
+        {
+            assert(real(r) == real(z));
+            assert(std::signbit(real(r)) == std::signbit(real(z)));
+        }
+        if (std::isnan(imag(r)))
+            assert(std::isnan(imag(z)));
+        else
+        {
+            assert(imag(r) == imag(z));
+            assert(std::signbit(imag(r)) == std::signbit(imag(z)));
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/pow_complex_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/pow_complex_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/pow_complex_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/pow_complex_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   pow(const complex<T>& x, const complex<T>& y);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& a, const std::complex<T>& b, std::complex<T> x)
+{
+    std::complex<T> c = pow(a, b);
+    is_about(real(c), real(x));
+    is_about(imag(c), imag(x));
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(2, 3), std::complex<T>(2, 0), std::complex<T>(-5, 12));
+}
+
+void test_edges()
+{
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        for (unsigned j = 0; j < N; ++j)
+        {
+            std::complex<double> r = pow(x[i], x[j]);
+            std::complex<double> z = exp(x[j] * log(x[i]));
+            if (std::isnan(real(r)))
+                assert(std::isnan(real(z)));
+            else
+            {
+                assert(real(r) == real(z));
+                assert(std::signbit(real(r)) == std::signbit(real(z)));
+            }
+            if (std::isnan(imag(r)))
+                assert(std::isnan(imag(z)));
+            else
+            {
+                assert(imag(r) == imag(z));
+                assert(std::signbit(imag(r)) == std::signbit(imag(z)));
+            }
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/pow_complex_scalar.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/pow_complex_scalar.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/pow_complex_scalar.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/pow_complex_scalar.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   pow(const complex<T>& x, const T& y);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& a, const T& b, std::complex<T> x)
+{
+    std::complex<T> c = pow(a, b);
+    is_about(real(c), real(x));
+    is_about(imag(c), imag(x));
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(2, 3), T(2), std::complex<T>(-5, 12));
+}
+
+void test_edges()
+{
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        for (unsigned j = 0; j < N; ++j)
+        {
+            std::complex<double> r = pow(x[i], real(x[j]));
+            std::complex<double> z = exp(std::complex<double>(real(x[j])) * log(x[i]));
+            if (std::isnan(real(r)))
+                assert(std::isnan(real(z)));
+            else
+            {
+                assert(real(r) == real(z));
+            }
+            if (std::isnan(imag(r)))
+                assert(std::isnan(imag(z)));
+            else
+            {
+                assert(imag(r) == imag(z));
+            }
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/pow_scalar_complex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/pow_scalar_complex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/pow_scalar_complex.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/pow_scalar_complex.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   pow(const T& x, const complex<T>& y);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const T& a, const std::complex<T>& b, std::complex<T> x)
+{
+    std::complex<T> c = pow(a, b);
+    is_about(real(c), real(x));
+    assert(std::abs(imag(c)) < 1.e-6);
+}
+
+template <class T>
+void
+test()
+{
+    test(T(2), std::complex<T>(2), std::complex<T>(4));
+}
+
+void test_edges()
+{
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        for (unsigned j = 0; j < N; ++j)
+        {
+            std::complex<double> r = pow(real(x[i]), x[j]);
+            std::complex<double> z = exp(x[j] * log(std::complex<double>(real(x[i]))));
+            if (std::isnan(real(r)))
+                assert(std::isnan(real(z)));
+            else
+            {
+                assert(real(r) == real(z));
+            }
+            if (std::isnan(imag(r)))
+                assert(std::isnan(imag(z)));
+            else
+            {
+                assert(imag(r) == imag(z));
+            }
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   sin(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& c, std::complex<T> x)
+{
+    assert(sin(c) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(0, 0), std::complex<T>(0, 0));
+}
+
+void test_edges()
+{
+    typedef std::complex<double> C;
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = sin(x[i]);
+        std::complex<double> t1(-imag(x[i]), real(x[i]));
+        std::complex<double> t2 = sinh(t1);
+        std::complex<double> z(imag(t2), -real(t2));
+        if (std::isnan(real(r)))
+            assert(std::isnan(real(z)));
+        else
+        {
+            assert(real(r) == real(z));
+            assert(std::signbit(real(r)) == std::signbit(real(z)));
+        }
+        if (std::isnan(imag(r)))
+            assert(std::isnan(imag(z)));
+        else
+        {
+            assert(imag(r) == imag(z));
+            assert(std::signbit(imag(r)) == std::signbit(imag(z)));
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,119 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   sinh(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& c, std::complex<T> x)
+{
+    assert(sinh(c) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(0, 0), std::complex<T>(0, 0));
+}
+
+void test_edges()
+{
+    typedef std::complex<double> C;
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = sinh(x[i]);
+        if (x[i].real() == 0 && x[i].imag() == 0)
+        {
+            assert(r.real() == 0);
+            assert(std::signbit(r.real()) == std::signbit(x[i].real()));
+            assert(r.imag() == 0);
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+        else if (x[i].real() == 0 && std::isinf(x[i].imag()))
+        {
+            assert(r.real() == 0);
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (x[i].real() == 0 && std::isnan(x[i].imag()))
+        {
+            assert(r.real() == 0);
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && x[i].imag() == 0)
+        {
+            assert(std::isinf(r.real()));
+            assert(std::signbit(r.real()) == std::signbit(x[i].real()));
+            assert(r.imag() == 0);
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+        else if (std::isinf(x[i].real()) && std::isfinite(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(std::signbit(r.real()) == std::signbit(x[i].real() * cos(x[i].imag())));
+            assert(std::isinf(r.imag()));
+            assert(std::signbit(r.imag()) == std::signbit(sin(x[i].imag())));
+        }
+        else if (std::isinf(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && x[i].imag() == 0)
+        {
+            assert(std::isnan(r.real()));
+            assert(r.imag() == 0);
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isfinite(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/sqrt.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/sqrt.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/sqrt.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/sqrt.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,109 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   sqrt(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& c, std::complex<T> x)
+{
+    std::complex<T> a = sqrt(c);
+    is_about(real(a), real(x));
+    assert(std::abs(imag(c)) < 1.e-6);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(64, 0), std::complex<T>(8, 0));
+}
+
+void test_edges()
+{
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = sqrt(x[i]);
+        if (x[i].real() == 0 && x[i].imag() == 0)
+        {
+            assert(!std::signbit(r.real()));
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+        else if (std::isinf(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(r.real() > 0);
+            assert(std::isinf(r.imag()));
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+        else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isfinite(x[i].imag()))
+        {
+            assert(r.real() == 0);
+            assert(!std::signbit(r.real()));
+            assert(std::isinf(r.imag()));
+            assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isfinite(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(r.real() > 0);
+            assert(r.imag() == 0);
+            assert(std::signbit(x[i].imag()) == std::signbit(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() < 0 && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isinf(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && x[i].real() > 0 && std::isnan(x[i].imag()))
+        {
+            assert(std::isinf(r.real()));
+            assert(r.real() > 0);
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && (std::isfinite(x[i].imag()) || std::isnan(x[i].imag())))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::signbit(x[i].imag()))
+        {
+            assert(!std::signbit(r.real()));
+            assert(std::signbit(r.imag()));
+        }
+        else
+        {
+            assert(!std::signbit(r.real()));
+            assert(!std::signbit(r.imag()));
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   tan(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& c, std::complex<T> x)
+{
+    assert(tan(c) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(0, 0), std::complex<T>(0, 0));
+    test(std::complex<T>(10000, -10000), std::complex<T>(0, -1));
+}
+
+void test_edges()
+{
+    typedef std::complex<double> C;
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = tan(x[i]);
+        std::complex<double> t1(-imag(x[i]), real(x[i]));
+        std::complex<double> t2 = tanh(t1);
+        std::complex<double> z(imag(t2), -real(t2));
+        if (std::isnan(real(r)))
+            assert(std::isnan(real(z)));
+        else
+        {
+            assert(real(r) == real(z));
+            assert(std::signbit(real(r)) == std::signbit(real(z)));
+        }
+        if (std::isnan(imag(r)))
+            assert(std::isnan(imag(z)));
+        else
+        {
+            assert(imag(r) == imag(z));
+            assert(std::signbit(imag(r)) == std::signbit(imag(z)));
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   tanh(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& c, std::complex<T> x)
+{
+    assert(tanh(c) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(0, 0), std::complex<T>(0, 0));
+}
+
+void test_edges()
+{
+    typedef std::complex<double> C;
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = tanh(x[i]);
+        if (x[i].real() == 0 && x[i].imag() == 0)
+        {
+            assert(r.real() == 0);
+            assert(std::signbit(r.real()) == std::signbit(x[i].real()));
+            assert(r.imag() == 0);
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+        else if (std::isfinite(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isfinite(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isinf(x[i].real()) && std::isfinite(x[i].imag()))
+        {
+            assert(r.real() == 1);
+            assert(r.imag() == 0);
+            assert(std::signbit(r.imag()) == std::signbit(sin(2*x[i].imag())));
+        }
+        else if (std::isinf(x[i].real()) && std::isinf(x[i].imag()))
+        {
+            assert(r.real() == 1);
+            assert(r.imag() == 0);
+        }
+        else if (std::isinf(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(r.real() == 1);
+            assert(r.imag() == 0);
+        }
+        else if (std::isnan(x[i].real()) && x[i].imag() == 0)
+        {
+            assert(std::isnan(r.real()));
+            assert(r.imag() == 0);
+            assert(std::signbit(r.imag()) == std::signbit(x[i].imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isfinite(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+        else if (std::isnan(x[i].real()) && std::isnan(x[i].imag()))
+        {
+            assert(std::isnan(r.real()));
+            assert(std::isnan(r.imag()));
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/abs.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/abs.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/abs.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/abs.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   T
+//   abs(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test()
+{
+    std::complex<T> z(3, 4);
+    assert(abs(z) == 5);
+}
+
+void test_edges()
+{
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        double r = abs(x[i]);
+        switch (classify(x[i]))
+        {
+        case zero:
+            assert(r == 0);
+            assert(!std::signbit(r));
+            break;
+        case non_zero:
+            assert(std::isfinite(r) && r > 0);
+            break;
+        case inf:
+            assert(std::isinf(r) && r > 0);
+            break;
+        case NaN:
+            assert(std::isnan(r));
+            break;
+        case non_zero_nan:
+            assert(std::isnan(r));
+            break;
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/arg.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/arg.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/arg.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/arg.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,135 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   T
+//   arg(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test()
+{
+    std::complex<T> z(1, 0);
+    assert(arg(z) == 0);
+}
+
+void test_edges()
+{
+    const double pi = std::atan2(+0., -0.);
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        double r = arg(x[i]);
+        if (std::isnan(x[i].real()) || std::isnan(x[i].imag()))
+            assert(std::isnan(r));
+        else
+        {
+            switch (classify(x[i]))
+            {
+            case zero:
+                if (std::signbit(x[i].real()))
+                {
+                    if (std::signbit(x[i].imag()))
+                        is_about(r, -pi);
+                    else
+                        is_about(r, pi);
+                }
+                else
+                {
+                    assert(std::signbit(x[i].imag()) == std::signbit(r));
+                }
+                break;
+            case non_zero:
+                if (x[i].real() == 0)
+                {
+                    if (x[i].imag() < 0)
+                        is_about(r, -pi/2);
+                    else
+                        is_about(r, pi/2);
+                }
+                else if (x[i].imag() == 0)
+                {
+                    if (x[i].real() < 0)
+                    {
+                        if (std::signbit(x[i].imag()))
+                            is_about(r, -pi);
+                        else
+                            is_about(r, pi);
+                    }
+                    else
+                    {
+                        assert(r == 0);
+                        assert(std::signbit(x[i].imag()) == std::signbit(r));
+                    }
+                }
+                else if (x[i].imag() > 0)
+                    assert(r > 0);
+                else
+                    assert(r < 0);
+                break;
+            case inf:
+                if (std::isinf(x[i].real()) && std::isinf(x[i].imag()))
+                {
+                    if (x[i].real() < 0)
+                    {
+                        if (x[i].imag() > 0)
+                            is_about(r, 0.75 * pi);
+                        else
+                            is_about(r, -0.75 * pi);
+                    }
+                    else
+                    {
+                        if (x[i].imag() > 0)
+                            is_about(r, 0.25 * pi);
+                        else
+                            is_about(r, -0.25 * pi);
+                    }
+                }
+                else if (std::isinf(x[i].real()))
+                {
+                    if (x[i].real() < 0)
+                    {
+                        if (std::signbit(x[i].imag()))
+                            is_about(r, -pi);
+                        else
+                            is_about(r, pi);
+                    }
+                    else
+                    {
+                        assert(r == 0);
+                        assert(std::signbit(r) == std::signbit(x[i].imag()));
+                    }
+                }
+                else
+                {
+                    if (x[i].imag() < 0)
+                        is_about(r, -pi/2);
+                    else
+                        is_about(r, pi/2);
+                }
+                break;
+            }
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/conj.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/conj.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/conj.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/conj.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   conj(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test(const std::complex<T>& z, std::complex<T> x)
+{
+    assert(conj(z) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(1, 2), std::complex<T>(1, -2));
+    test(std::complex<T>(-1, 2), std::complex<T>(-1, -2));
+    test(std::complex<T>(1, -2), std::complex<T>(1, 2));
+    test(std::complex<T>(-1, -2), std::complex<T>(-1, 2));
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/imag.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/imag.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/imag.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/imag.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   T
+//   imag(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    std::complex<T> z(1.5, 2.5);
+    assert(imag(z) == 2.5);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/norm.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/norm.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/norm.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/norm.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   T
+//   norm(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test()
+{
+    std::complex<T> z(3, 4);
+    assert(norm(z) == 25);
+}
+
+void test_edges()
+{
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        double r = norm(x[i]);
+        switch (classify(x[i]))
+        {
+        case zero:
+            assert(r == 0);
+            assert(!std::signbit(r));
+            break;
+        case non_zero:
+            assert(std::isfinite(r) && r > 0);
+            break;
+        case inf:
+            assert(std::isinf(r) && r > 0);
+            break;
+        case NaN:
+            assert(std::isnan(r));
+            break;
+        case non_zero_nan:
+            assert(std::isnan(r));
+            break;
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/polar.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,112 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   polar(const T& rho, const T& theta = 0);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const T& rho, std::complex<T> x)
+{
+    assert(std::polar(rho) == x);
+}
+
+template <class T>
+void
+test(const T& rho, const T& theta, std::complex<T> x)
+{
+    assert(std::polar(rho, theta) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(T(0), std::complex<T>(0, 0));
+    test(T(1), std::complex<T>(1, 0));
+    test(T(100), std::complex<T>(100, 0));
+    test(T(0), T(0), std::complex<T>(0, 0));
+    test(T(1), T(0), std::complex<T>(1, 0));
+    test(T(100), T(0), std::complex<T>(100, 0));
+}
+
+void test_edges()
+{
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        double r = real(x[i]);
+        double theta = imag(x[i]);
+        std::complex<double> z = std::polar(r, theta);
+        switch (classify(r))
+        {
+        case zero:
+            if (std::signbit(r) || classify(theta) == inf || classify(theta) == NaN)
+            {
+                int c = classify(z);
+                assert(c == NaN || c == non_zero_nan);
+            }
+            else
+            {
+                assert(z == std::complex<double>());
+            }
+            break;
+        case non_zero:
+            if (std::signbit(r) || classify(theta) == inf || classify(theta) == NaN)
+            {
+                int c = classify(z);
+                assert(c == NaN || c == non_zero_nan);
+            }
+            else
+            {
+                is_about(std::abs(z), r);
+            }
+            break;
+        case inf:
+            if (r < 0)
+            {
+                int c = classify(z);
+                assert(c == NaN || c == non_zero_nan);
+            }
+            else
+            {
+                assert(classify(z) == inf);
+                if (classify(theta) != NaN && classify(theta) != inf)
+                {
+                    assert(classify(real(z)) != NaN);
+                    assert(classify(imag(z)) != NaN);
+                }
+            }
+            break;
+        case NaN:
+        case non_zero_nan:
+            {
+                int c = classify(z);
+                assert(c == NaN || c == non_zero_nan);
+            }
+            break;
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/proj.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/proj.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/proj.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/proj.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   complex<T>
+//   proj(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "../cases.h"
+
+template <class T>
+void
+test(const std::complex<T>& z, std::complex<T> x)
+{
+    assert(proj(z) == x);
+}
+
+template <class T>
+void
+test()
+{
+    test(std::complex<T>(1, 2), std::complex<T>(1, 2));
+    test(std::complex<T>(-1, 2), std::complex<T>(-1, 2));
+    test(std::complex<T>(1, -2), std::complex<T>(1, -2));
+    test(std::complex<T>(-1, -2), std::complex<T>(-1, -2));
+}
+
+void test_edges()
+{
+    const unsigned N = sizeof(x) / sizeof(x[0]);
+    for (unsigned i = 0; i < N; ++i)
+    {
+        std::complex<double> r = proj(x[i]);
+        switch (classify(x[i]))
+        {
+        case zero:
+        case non_zero:
+            assert(r == x[i]);
+            assert(std::signbit(real(r)) == std::signbit(real(x[i])));
+            assert(std::signbit(imag(r)) == std::signbit(imag(x[i])));
+            break;
+        case inf:
+            assert(std::isinf(real(r)) && real(r) > 0);
+            assert(imag(r) == 0);
+            assert(std::signbit(imag(r)) == std::signbit(imag(x[i])));
+            break;
+        case NaN:
+        case non_zero_nan:
+            assert(classify(r) == classify(x[i]));
+            break;
+        }
+    }
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+    test_edges();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/real.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/real.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/real.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex.value.ops/real.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+//   T
+//   real(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    std::complex<T> z(1.5, 2.5);
+    assert(real(z) == 1.5);
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/complex/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/complex/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/complex/types.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/complex/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+// class complex
+// {
+// public:
+//   typedef T value_type;
+//   ...
+// };
+
+#include <complex>
+#include <type_traits>
+
+template <class T>
+void
+test()
+{
+    typedef std::complex<T> C;
+    static_assert((std::is_same<typename C::value_type, T>::value), "");
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/layout.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/layout.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/layout.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/layout.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test()
+{
+    std::complex<T> z;
+    T* a = (T*)&z;
+    assert(0 == z.real());
+    assert(0 == z.imag());
+    assert(a[0] == z.real());
+    assert(a[1] == z.imag());
+    a[0] = 5;
+    a[1] = 6;
+    assert(a[0] == z.real());
+    assert(a[1] == z.imag());
+}
+
+int main()
+{
+    test<float>();
+    test<double>();
+    test<long double>();
+}

Added: libcxx/trunk/test/std/numerics/complex.number/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/version.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/complex.number/version.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+#include <complex>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/numerics/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/numerics/numarray/class.gslice/gslice.access/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/class.gslice/gslice.access/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/class.gslice/gslice.access/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/class.gslice/gslice.access/tested_elsewhere.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/numerics/numarray/class.gslice/gslice.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/class.gslice/gslice.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/class.gslice/gslice.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/class.gslice/gslice.cons/default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// class glice;
+
+// gslice();
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    std::gslice gs;
+    assert(gs.start() == 0);
+    assert(gs.size().size() == 0);
+    assert(gs.stride().size() == 0);
+}

Added: libcxx/trunk/test/std/numerics/numarray/class.gslice/gslice.cons/start_size_stride.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/class.gslice/gslice.cons/start_size_stride.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/class.gslice/gslice.cons/start_size_stride.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/class.gslice/gslice.cons/start_size_stride.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// class glice;
+
+// gslice(size_t start, const valarray<size_t>& size,
+//                      const valarray<size_t>& stride);
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    std::size_t a1[] = {1, 2, 3};
+    std::size_t a2[] = {4, 5, 6};
+    std::valarray<std::size_t> size(a1, sizeof(a1)/sizeof(a1[0]));
+    std::valarray<std::size_t> stride(a2, sizeof(a2)/sizeof(a2[0]));
+    std::gslice gs(7, size, stride);
+    assert(gs.start() == 7);
+    std::valarray<std::size_t> r = gs.size();
+    assert(r.size() == 3);
+    assert(r[0] == 1);
+    assert(r[1] == 2);
+    assert(r[2] == 3);
+    r = gs.stride();
+    assert(r.size() == 3);
+    assert(r[0] == 4);
+    assert(r[1] == 5);
+    assert(r[2] == 6);
+}

Added: libcxx/trunk/test/std/numerics/numarray/class.gslice/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/class.gslice/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/class.gslice/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/class.gslice/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/numerics/numarray/class.slice/cons.slice/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/class.slice/cons.slice/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/class.slice/cons.slice/default.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/class.slice/cons.slice/default.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// class slice;
+
+// slice();
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    std::slice s;
+    assert(s.start() == 0);
+    assert(s.size() == 0);
+    assert(s.stride() == 0);
+}

Added: libcxx/trunk/test/std/numerics/numarray/class.slice/cons.slice/start_size_stride.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/class.slice/cons.slice/start_size_stride.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/class.slice/cons.slice/start_size_stride.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/class.slice/cons.slice/start_size_stride.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// class slice;
+
+// slice(size_t start, size_t size, size_t stride);
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    std::slice s(1, 3, 2);
+    assert(s.start() == 1);
+    assert(s.size() == 3);
+    assert(s.stride() == 2);
+}

Added: libcxx/trunk/test/std/numerics/numarray/class.slice/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/class.slice/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/class.slice/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/class.slice/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/numerics/numarray/class.slice/slice.access/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/class.slice/slice.access/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/class.slice/slice.access/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/class.slice/slice.access/tested_elsewhere.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.gslice.array/default.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.gslice.array/default.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.gslice.array/default.fail.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.gslice.array/default.fail.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class gslice_array
+
+// gslice_array() = delete;
+
+#include <valarray>
+#include <type_traits>
+
+int main()
+{
+    std::gslice_array<int> gs;
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.assign/gslice_array.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.assign/gslice_array.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.assign/gslice_array.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.assign/gslice_array.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class gslice_array
+
+// const gslice_array& operator=(const gslice_array& ga) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    int a2[] = { -0,  -1,  -2,  -3,  -4,  -5,  -6,  -7,  -8,  -9, -10, -11,
+                -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23,
+                -24, -25, -26, -27, -28, -29, -30, -31, -32, -33, -34, -35,
+                -36, -37};
+    std::valarray<int> v1(a1, sizeof(a1)/sizeof(a1[0]));
+    const std::valarray<int> v2(a2, sizeof(a2)/sizeof(a2[0]));
+    std::size_t sz[] = {2, 4, 3};
+    std::size_t st[] = {19, 4, 1};
+    typedef std::valarray<std::size_t> sizes;
+    typedef std::valarray<std::size_t> strides;
+    v1[std::gslice(3, sizes(sz, sizeof(sz)/sizeof(sz[0])),
+                      strides(st, sizeof(st)/sizeof(st[0])))]
+        = v2[std::gslice(3, sizes(sz, sizeof(sz)/sizeof(sz[0])),
+                            strides(st, sizeof(st)/sizeof(st[0])))];
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] == -3);
+    assert(v1[ 4] == -4);
+    assert(v1[ 5] == -5);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] == -7);
+    assert(v1[ 8] == -8);
+    assert(v1[ 9] == -9);
+    assert(v1[10] == 10);
+    assert(v1[11] == -11);
+    assert(v1[12] == -12);
+    assert(v1[13] == -13);
+    assert(v1[14] == 14);
+    assert(v1[15] == -15);
+    assert(v1[16] == -16);
+    assert(v1[17] == -17);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] == -22);
+    assert(v1[23] == -23);
+    assert(v1[24] == -24);
+    assert(v1[25] == 25);
+    assert(v1[26] == -26);
+    assert(v1[27] == -27);
+    assert(v1[28] == -28);
+    assert(v1[29] == 29);
+    assert(v1[30] == -30);
+    assert(v1[31] == -31);
+    assert(v1[32] == -32);
+    assert(v1[33] == 33);
+    assert(v1[34] == -34);
+    assert(v1[35] == -35);
+    assert(v1[36] == -36);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.assign/valarray.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.assign/valarray.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.assign/valarray.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.assign/valarray.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class gslice_array
+
+// void operator=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    int a2[] = { -0,  -1,  -2,  -3,  -4,  -5,  -6,  -7,  -8,  -9, -10, -11,
+                -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23};
+    std::valarray<int> v1(a1, sizeof(a1)/sizeof(a1[0]));
+    std::valarray<int> v2(a2, sizeof(a2)/sizeof(a2[0]));
+    std::size_t sz[] = {2, 4, 3};
+    std::size_t st[] = {19, 4, 1};
+    typedef std::valarray<std::size_t> sizes;
+    typedef std::valarray<std::size_t> strides;
+    v1[std::gslice(3, sizes(sz, sizeof(sz)/sizeof(sz[0])),
+                      strides(st, sizeof(st)/sizeof(st[0])))] = v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] == 0);
+    assert(v1[ 4] == -1);
+    assert(v1[ 5] == -2);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] == -3);
+    assert(v1[ 8] == -4);
+    assert(v1[ 9] == -5);
+    assert(v1[10] == 10);
+    assert(v1[11] == -6);
+    assert(v1[12] == -7);
+    assert(v1[13] == -8);
+    assert(v1[14] == 14);
+    assert(v1[15] == -9);
+    assert(v1[16] == -10);
+    assert(v1[17] == -11);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] == -12);
+    assert(v1[23] == -13);
+    assert(v1[24] == -14);
+    assert(v1[25] == 25);
+    assert(v1[26] == -15);
+    assert(v1[27] == -16);
+    assert(v1[28] == -17);
+    assert(v1[29] == 29);
+    assert(v1[30] == -18);
+    assert(v1[31] == -19);
+    assert(v1[32] == -20);
+    assert(v1[33] == 33);
+    assert(v1[34] == -21);
+    assert(v1[35] == -22);
+    assert(v1[36] == -23);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/addition.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/addition.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/addition.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/addition.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class gslice_array
+
+// void operator+= (const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    int a2[] = { -0,  -1,  -2,  -3,  -4,  -5,  -6,  -7,  -8,  -9, -10, -11,
+                -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23};
+    std::valarray<int> v1(a1, sizeof(a1)/sizeof(a1[0]));
+    std::valarray<int> v2(a2, sizeof(a2)/sizeof(a2[0]));
+    std::size_t sz[] = {2, 4, 3};
+    std::size_t st[] = {19, 4, 1};
+    typedef std::valarray<std::size_t> sizes;
+    typedef std::valarray<std::size_t> strides;
+    v1[std::gslice(3, sizes(sz, sizeof(sz)/sizeof(sz[0])),
+                      strides(st, sizeof(st)/sizeof(st[0])))] += v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  3);
+    assert(v1[ 4] ==  3);
+    assert(v1[ 5] ==  3);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  4);
+    assert(v1[ 8] ==  4);
+    assert(v1[ 9] ==  4);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  5);
+    assert(v1[12] ==  5);
+    assert(v1[13] ==  5);
+    assert(v1[14] == 14);
+    assert(v1[15] ==  6);
+    assert(v1[16] ==  6);
+    assert(v1[17] ==  6);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] == 10);
+    assert(v1[23] == 10);
+    assert(v1[24] == 10);
+    assert(v1[25] == 25);
+    assert(v1[26] == 11);
+    assert(v1[27] == 11);
+    assert(v1[28] == 11);
+    assert(v1[29] == 29);
+    assert(v1[30] == 12);
+    assert(v1[31] == 12);
+    assert(v1[32] == 12);
+    assert(v1[33] == 33);
+    assert(v1[34] == 13);
+    assert(v1[35] == 13);
+    assert(v1[36] == 13);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/and.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/and.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/and.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/and.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class gslice_array
+
+// void operator&= (const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    std::valarray<int> v1(a1, sizeof(a1)/sizeof(a1[0]));
+    std::valarray<int> v2(a2, sizeof(a2)/sizeof(a2[0]));
+    std::size_t sz[] = {2, 4, 3};
+    std::size_t st[] = {19, 4, 1};
+    typedef std::valarray<std::size_t> sizes;
+    typedef std::valarray<std::size_t> strides;
+    v1[std::gslice(3, sizes(sz, sizeof(sz)/sizeof(sz[0])),
+                      strides(st, sizeof(st)/sizeof(st[0])))] &= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  1);
+    assert(v1[ 4] ==  0);
+    assert(v1[ 5] ==  1);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  4);
+    assert(v1[ 8] ==  0);
+    assert(v1[ 9] ==  0);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  3);
+    assert(v1[12] ==  8);
+    assert(v1[13] ==  9);
+    assert(v1[14] == 14);
+    assert(v1[15] == 10);
+    assert(v1[16] ==  0);
+    assert(v1[17] ==  0);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] ==  4);
+    assert(v1[23] ==  6);
+    assert(v1[24] ==  8);
+    assert(v1[25] == 25);
+    assert(v1[26] == 16);
+    assert(v1[27] == 17);
+    assert(v1[28] == 16);
+    assert(v1[29] == 29);
+    assert(v1[30] == 18);
+    assert(v1[31] == 20);
+    assert(v1[32] ==  0);
+    assert(v1[33] == 33);
+    assert(v1[34] ==  2);
+    assert(v1[35] ==  3);
+    assert(v1[36] ==  0);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/divide.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/divide.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/divide.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/divide.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class gslice_array
+
+// void operator/= (const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    std::valarray<int> v1(a1, sizeof(a1)/sizeof(a1[0]));
+    std::valarray<int> v2(a2, sizeof(a2)/sizeof(a2[0]));
+    std::size_t sz[] = {2, 4, 3};
+    std::size_t st[] = {19, 4, 1};
+    typedef std::valarray<std::size_t> sizes;
+    typedef std::valarray<std::size_t> strides;
+    v1[std::gslice(3, sizes(sz, sizeof(sz)/sizeof(sz[0])),
+                      strides(st, sizeof(st)/sizeof(st[0])))] /= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  3);
+    assert(v1[ 4] ==  2);
+    assert(v1[ 5] ==  1);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  1);
+    assert(v1[ 8] ==  1);
+    assert(v1[ 9] ==  1);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  1);
+    assert(v1[12] ==  1);
+    assert(v1[13] ==  1);
+    assert(v1[14] == 14);
+    assert(v1[15] ==  1);
+    assert(v1[16] ==  1);
+    assert(v1[17] ==  1);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] ==  1);
+    assert(v1[23] ==  1);
+    assert(v1[24] ==  1);
+    assert(v1[25] == 25);
+    assert(v1[26] ==  1);
+    assert(v1[27] ==  1);
+    assert(v1[28] ==  1);
+    assert(v1[29] == 29);
+    assert(v1[30] ==  1);
+    assert(v1[31] ==  1);
+    assert(v1[32] ==  1);
+    assert(v1[33] == 33);
+    assert(v1[34] ==  1);
+    assert(v1[35] ==  1);
+    assert(v1[36] ==  1);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/modulo.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/modulo.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/modulo.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/modulo.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class gslice_array
+
+// void operator%= (const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    std::valarray<int> v1(a1, sizeof(a1)/sizeof(a1[0]));
+    std::valarray<int> v2(a2, sizeof(a2)/sizeof(a2[0]));
+    std::size_t sz[] = {2, 4, 3};
+    std::size_t st[] = {19, 4, 1};
+    typedef std::valarray<std::size_t> sizes;
+    typedef std::valarray<std::size_t> strides;
+    v1[std::gslice(3, sizes(sz, sizeof(sz)/sizeof(sz[0])),
+                      strides(st, sizeof(st)/sizeof(st[0])))] %= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  0);
+    assert(v1[ 4] ==  0);
+    assert(v1[ 5] ==  2);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  3);
+    assert(v1[ 8] ==  3);
+    assert(v1[ 9] ==  3);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  4);
+    assert(v1[12] ==  4);
+    assert(v1[13] ==  4);
+    assert(v1[14] == 14);
+    assert(v1[15] ==  5);
+    assert(v1[16] ==  5);
+    assert(v1[17] ==  5);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] ==  9);
+    assert(v1[23] ==  9);
+    assert(v1[24] ==  9);
+    assert(v1[25] == 25);
+    assert(v1[26] == 10);
+    assert(v1[27] == 10);
+    assert(v1[28] == 10);
+    assert(v1[29] == 29);
+    assert(v1[30] == 11);
+    assert(v1[31] == 11);
+    assert(v1[32] == 11);
+    assert(v1[33] == 33);
+    assert(v1[34] == 12);
+    assert(v1[35] == 12);
+    assert(v1[36] == 12);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/multiply.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/multiply.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/multiply.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/multiply.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class gslice_array
+
+// void operator*= (const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    std::valarray<int> v1(a1, sizeof(a1)/sizeof(a1[0]));
+    std::valarray<int> v2(a2, sizeof(a2)/sizeof(a2[0]));
+    std::size_t sz[] = {2, 4, 3};
+    std::size_t st[] = {19, 4, 1};
+    typedef std::valarray<std::size_t> sizes;
+    typedef std::valarray<std::size_t> strides;
+    v1[std::gslice(3, sizes(sz, sizeof(sz)/sizeof(sz[0])),
+                      strides(st, sizeof(st)/sizeof(st[0])))] *= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  3);
+    assert(v1[ 4] ==  8);
+    assert(v1[ 5] == 15);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] == 28);
+    assert(v1[ 8] == 40);
+    assert(v1[ 9] == 54);
+    assert(v1[10] == 10);
+    assert(v1[11] == 77);
+    assert(v1[12] == 96);
+    assert(v1[13] == 117);
+    assert(v1[14] == 14);
+    assert(v1[15] == 150);
+    assert(v1[16] == 176);
+    assert(v1[17] == 204);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] == 286);
+    assert(v1[23] == 322);
+    assert(v1[24] == 360);
+    assert(v1[25] == 25);
+    assert(v1[26] == 416);
+    assert(v1[27] == 459);
+    assert(v1[28] == 504);
+    assert(v1[29] == 29);
+    assert(v1[30] == 570);
+    assert(v1[31] == 620);
+    assert(v1[32] == 672);
+    assert(v1[33] == 33);
+    assert(v1[34] == 748);
+    assert(v1[35] == 805);
+    assert(v1[36] == 864);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/or.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/or.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/or.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/or.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class gslice_array
+
+// void operator|= (const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    std::valarray<int> v1(a1, sizeof(a1)/sizeof(a1[0]));
+    std::valarray<int> v2(a2, sizeof(a2)/sizeof(a2[0]));
+    std::size_t sz[] = {2, 4, 3};
+    std::size_t st[] = {19, 4, 1};
+    typedef std::valarray<std::size_t> sizes;
+    typedef std::valarray<std::size_t> strides;
+    v1[std::gslice(3, sizes(sz, sizeof(sz)/sizeof(sz[0])),
+                      strides(st, sizeof(st)/sizeof(st[0])))] |= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  3);
+    assert(v1[ 4] ==  6);
+    assert(v1[ 5] ==  7);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  7);
+    assert(v1[ 8] == 13);
+    assert(v1[ 9] == 15);
+    assert(v1[10] == 10);
+    assert(v1[11] == 15);
+    assert(v1[12] == 12);
+    assert(v1[13] == 13);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15);
+    assert(v1[16] == 27);
+    assert(v1[17] == 29);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] == 31);
+    assert(v1[23] == 31);
+    assert(v1[24] == 31);
+    assert(v1[25] == 25);
+    assert(v1[26] == 26);
+    assert(v1[27] == 27);
+    assert(v1[28] == 30);
+    assert(v1[29] == 29);
+    assert(v1[30] == 31);
+    assert(v1[31] == 31);
+    assert(v1[32] == 53);
+    assert(v1[33] == 33);
+    assert(v1[34] == 54);
+    assert(v1[35] == 55);
+    assert(v1[36] == 60);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/shift_left.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/shift_left.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/shift_left.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/shift_left.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class gslice_array
+
+// void operator<<= (const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    std::valarray<int> v1(a1, sizeof(a1)/sizeof(a1[0]));
+    std::valarray<int> v2(a2, sizeof(a2)/sizeof(a2[0]));
+    std::size_t sz[] = {2, 4, 3};
+    std::size_t st[] = {19, 4, 1};
+    typedef std::valarray<std::size_t> sizes;
+    typedef std::valarray<std::size_t> strides;
+    v1[std::gslice(3, sizes(sz, sizeof(sz)/sizeof(sz[0])),
+                      strides(st, sizeof(st)/sizeof(st[0])))] <<= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  6);
+    assert(v1[ 4] == 16);
+    assert(v1[ 5] == 40);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] == 112);
+    assert(v1[ 8] == 256);
+    assert(v1[ 9] == 576);
+    assert(v1[10] == 10);
+    assert(v1[11] == 1408);
+    assert(v1[12] == 3072);
+    assert(v1[13] == 6656);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15360);
+    assert(v1[16] == 32768);
+    assert(v1[17] == 69632);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] == 180224);
+    assert(v1[23] == 376832);
+    assert(v1[24] == 786432);
+    assert(v1[25] == 25);
+    assert(v1[26] == 1703936);
+    assert(v1[27] == 3538944);
+    assert(v1[28] == 7340032);
+    assert(v1[29] == 29);
+    assert(v1[30] == 15728640);
+    assert(v1[31] == 32505856);
+    assert(v1[32] == 67108864);
+    assert(v1[33] == 33);
+    assert(v1[34] == 142606336);
+    assert(v1[35] == 293601280);
+    assert(v1[36] == 603979776);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/shift_right.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/shift_right.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/shift_right.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/shift_right.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class gslice_array
+
+// void operator>>= (const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    std::valarray<int> v1(a1, sizeof(a1)/sizeof(a1[0]));
+    std::valarray<int> v2(a2, sizeof(a2)/sizeof(a2[0]));
+    std::size_t sz[] = {2, 4, 3};
+    std::size_t st[] = {19, 4, 1};
+    typedef std::valarray<std::size_t> sizes;
+    typedef std::valarray<std::size_t> strides;
+    v1[std::gslice(3, sizes(sz, sizeof(sz)/sizeof(sz[0])),
+                      strides(st, sizeof(st)/sizeof(st[0])))] >>= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  1);
+    assert(v1[ 4] ==  1);
+    assert(v1[ 5] ==  0);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  0);
+    assert(v1[ 8] ==  0);
+    assert(v1[ 9] ==  0);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  0);
+    assert(v1[12] ==  0);
+    assert(v1[13] ==  0);
+    assert(v1[14] == 14);
+    assert(v1[15] ==  0);
+    assert(v1[16] ==  0);
+    assert(v1[17] ==  0);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] ==  0);
+    assert(v1[23] ==  0);
+    assert(v1[24] ==  0);
+    assert(v1[25] == 25);
+    assert(v1[26] ==  0);
+    assert(v1[27] ==  0);
+    assert(v1[28] ==  0);
+    assert(v1[29] == 29);
+    assert(v1[30] ==  0);
+    assert(v1[31] ==  0);
+    assert(v1[32] ==  0);
+    assert(v1[33] == 33);
+    assert(v1[34] ==  0);
+    assert(v1[35] ==  0);
+    assert(v1[36] ==  0);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/subtraction.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/subtraction.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/subtraction.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/subtraction.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class gslice_array
+
+// void operator-= (const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    std::valarray<int> v1(a1, sizeof(a1)/sizeof(a1[0]));
+    std::valarray<int> v2(a2, sizeof(a2)/sizeof(a2[0]));
+    std::size_t sz[] = {2, 4, 3};
+    std::size_t st[] = {19, 4, 1};
+    typedef std::valarray<std::size_t> sizes;
+    typedef std::valarray<std::size_t> strides;
+    v1[std::gslice(3, sizes(sz, sizeof(sz)/sizeof(sz[0])),
+                      strides(st, sizeof(st)/sizeof(st[0])))] -= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  2);
+    assert(v1[ 4] ==  2);
+    assert(v1[ 5] ==  2);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  3);
+    assert(v1[ 8] ==  3);
+    assert(v1[ 9] ==  3);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  4);
+    assert(v1[12] ==  4);
+    assert(v1[13] ==  4);
+    assert(v1[14] == 14);
+    assert(v1[15] ==  5);
+    assert(v1[16] ==  5);
+    assert(v1[17] ==  5);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] ==  9);
+    assert(v1[23] ==  9);
+    assert(v1[24] ==  9);
+    assert(v1[25] == 25);
+    assert(v1[26] == 10);
+    assert(v1[27] == 10);
+    assert(v1[28] == 10);
+    assert(v1[29] == 29);
+    assert(v1[30] == 11);
+    assert(v1[31] == 11);
+    assert(v1[32] == 11);
+    assert(v1[33] == 33);
+    assert(v1[34] == 12);
+    assert(v1[35] == 12);
+    assert(v1[36] == 12);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/xor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/xor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/xor.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.comp.assign/xor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class gslice_array
+
+// void operator^= (const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    std::valarray<int> v1(a1, sizeof(a1)/sizeof(a1[0]));
+    std::valarray<int> v2(a2, sizeof(a2)/sizeof(a2[0]));
+    std::size_t sz[] = {2, 4, 3};
+    std::size_t st[] = {19, 4, 1};
+    typedef std::valarray<std::size_t> sizes;
+    typedef std::valarray<std::size_t> strides;
+    v1[std::gslice(3, sizes(sz, sizeof(sz)/sizeof(sz[0])),
+                      strides(st, sizeof(st)/sizeof(st[0])))] ^= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  2);
+    assert(v1[ 4] ==  6);
+    assert(v1[ 5] ==  6);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  3);
+    assert(v1[ 8] == 13);
+    assert(v1[ 9] == 15);
+    assert(v1[10] == 10);
+    assert(v1[11] == 12);
+    assert(v1[12] ==  4);
+    assert(v1[13] ==  4);
+    assert(v1[14] == 14);
+    assert(v1[15] ==  5);
+    assert(v1[16] == 27);
+    assert(v1[17] == 29);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] == 27);
+    assert(v1[23] == 25);
+    assert(v1[24] == 23);
+    assert(v1[25] == 25);
+    assert(v1[26] == 10);
+    assert(v1[27] == 10);
+    assert(v1[28] == 14);
+    assert(v1[29] == 29);
+    assert(v1[30] == 13);
+    assert(v1[31] == 11);
+    assert(v1[32] == 53);
+    assert(v1[33] == 33);
+    assert(v1[34] == 52);
+    assert(v1[35] == 52);
+    assert(v1[36] == 60);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.fill/assign_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.fill/assign_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.fill/assign_value.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.gslice.array/gslice.array.fill/assign_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class gslice_array
+
+// void operator=(const value_type& x) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    std::valarray<int> v1(a1, sizeof(a1)/sizeof(a1[0]));
+    std::size_t sz[] = {2, 4, 3};
+    std::size_t st[] = {19, 4, 1};
+    typedef std::valarray<std::size_t> sizes;
+    typedef std::valarray<std::size_t> strides;
+    v1[std::gslice(3, sizes(sz, sizeof(sz)/sizeof(sz[0])),
+                      strides(st, sizeof(st)/sizeof(st[0])))] = 51;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] == 51);
+    assert(v1[ 4] == 51);
+    assert(v1[ 5] == 51);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] == 51);
+    assert(v1[ 8] == 51);
+    assert(v1[ 9] == 51);
+    assert(v1[10] == 10);
+    assert(v1[11] == 51);
+    assert(v1[12] == 51);
+    assert(v1[13] == 51);
+    assert(v1[14] == 14);
+    assert(v1[15] == 51);
+    assert(v1[16] == 51);
+    assert(v1[17] == 51);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] == 51);
+    assert(v1[23] == 51);
+    assert(v1[24] == 51);
+    assert(v1[25] == 25);
+    assert(v1[26] == 51);
+    assert(v1[27] == 51);
+    assert(v1[28] == 51);
+    assert(v1[29] == 29);
+    assert(v1[30] == 51);
+    assert(v1[31] == 51);
+    assert(v1[32] == 51);
+    assert(v1[33] == 33);
+    assert(v1[34] == 51);
+    assert(v1[35] == 51);
+    assert(v1[36] == 51);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.gslice.array/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.gslice.array/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.gslice.array/types.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.gslice.array/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T>
+// class gslice_array
+// {
+// public:
+//     typedef T value_type;
+
+#include <valarray>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::gslice_array<int>::value_type, int>::value), "");
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.indirect.array/default.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.indirect.array/default.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.indirect.array/default.fail.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.indirect.array/default.fail.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class indirect_array
+
+// indirect_array() = delete;
+
+#include <valarray>
+#include <type_traits>
+
+int main()
+{
+    std::indirect_array<int> ia;
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.assign/indirect_array.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.assign/indirect_array.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.assign/indirect_array.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.assign/indirect_array.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class indirect_array
+
+// const indirect_array& operator=(const indirect_array& ia) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = { -0,  -1,  -2,  -3,  -4,  -5,  -6,  -7,  -8,  -9, -10, -11,
+                -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23,
+                -24, -25, -26, -27, -28, -29, -30, -31, -32, -33, -34, -35,
+                -36, -37};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    std::size_t s[] = { 3,  4,  5,  7,  8,  9, 11, 12, 13, 15, 16, 17,
+                       22, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36};
+    const std::size_t S = sizeof(s)/sizeof(s[0]);
+    std::valarray<int> v1(a1, N1);
+    const std::valarray<int> v2(a2, N2);
+    std::valarray<std::size_t> ia(s, S);
+    v1[ia] = v2[ia];
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] == -3);
+    assert(v1[ 4] == -4);
+    assert(v1[ 5] == -5);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] == -7);
+    assert(v1[ 8] == -8);
+    assert(v1[ 9] == -9);
+    assert(v1[10] == 10);
+    assert(v1[11] == -11);
+    assert(v1[12] == -12);
+    assert(v1[13] == -13);
+    assert(v1[14] == 14);
+    assert(v1[15] == -15);
+    assert(v1[16] == -16);
+    assert(v1[17] == -17);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] == -22);
+    assert(v1[23] == -23);
+    assert(v1[24] == -24);
+    assert(v1[25] == 25);
+    assert(v1[26] == -26);
+    assert(v1[27] == -27);
+    assert(v1[28] == -28);
+    assert(v1[29] == 29);
+    assert(v1[30] == -30);
+    assert(v1[31] == -31);
+    assert(v1[32] == -32);
+    assert(v1[33] == 33);
+    assert(v1[34] == -34);
+    assert(v1[35] == -35);
+    assert(v1[36] == -36);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.assign/valarray.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.assign/valarray.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.assign/valarray.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.assign/valarray.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class indirect_array
+
+// void operator=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = { -0,  -1,  -2,  -3,  -4,  -5,  -6,  -7,  -8,  -9, -10, -11,
+                -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    std::size_t s[N2] = { 3,  4,  5,  7,  8,  9, 11, 12, 13, 15, 16, 17,
+                         22, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    std::valarray<std::size_t> ia(s, N2);
+    v1[ia] = v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] == 0);
+    assert(v1[ 4] == -1);
+    assert(v1[ 5] == -2);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] == -3);
+    assert(v1[ 8] == -4);
+    assert(v1[ 9] == -5);
+    assert(v1[10] == 10);
+    assert(v1[11] == -6);
+    assert(v1[12] == -7);
+    assert(v1[13] == -8);
+    assert(v1[14] == 14);
+    assert(v1[15] == -9);
+    assert(v1[16] == -10);
+    assert(v1[17] == -11);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] == -12);
+    assert(v1[23] == -13);
+    assert(v1[24] == -14);
+    assert(v1[25] == 25);
+    assert(v1[26] == -15);
+    assert(v1[27] == -16);
+    assert(v1[28] == -17);
+    assert(v1[29] == 29);
+    assert(v1[30] == -18);
+    assert(v1[31] == -19);
+    assert(v1[32] == -20);
+    assert(v1[33] == 33);
+    assert(v1[34] == -21);
+    assert(v1[35] == -22);
+    assert(v1[36] == -23);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/addition.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/addition.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/addition.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/addition.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class indirect_array
+
+// void operator+=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = { -0,  -1,  -2,  -3,  -4,  -5,  -6,  -7,  -8,  -9, -10, -11,
+                -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    std::size_t s[N2] = { 3,  4,  5,  7,  8,  9, 11, 12, 13, 15, 16, 17,
+                         22, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    std::valarray<std::size_t> ia(s, N2);
+    v1[ia] += v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  3);
+    assert(v1[ 4] ==  3);
+    assert(v1[ 5] ==  3);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  4);
+    assert(v1[ 8] ==  4);
+    assert(v1[ 9] ==  4);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  5);
+    assert(v1[12] ==  5);
+    assert(v1[13] ==  5);
+    assert(v1[14] == 14);
+    assert(v1[15] ==  6);
+    assert(v1[16] ==  6);
+    assert(v1[17] ==  6);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] == 10);
+    assert(v1[23] == 10);
+    assert(v1[24] == 10);
+    assert(v1[25] == 25);
+    assert(v1[26] == 11);
+    assert(v1[27] == 11);
+    assert(v1[28] == 11);
+    assert(v1[29] == 29);
+    assert(v1[30] == 12);
+    assert(v1[31] == 12);
+    assert(v1[32] == 12);
+    assert(v1[33] == 33);
+    assert(v1[34] == 13);
+    assert(v1[35] == 13);
+    assert(v1[36] == 13);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/and.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/and.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/and.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/and.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class indirect_array
+
+// void operator&=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    std::size_t s[N2] = { 3,  4,  5,  7,  8,  9, 11, 12, 13, 15, 16, 17,
+                         22, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    std::valarray<std::size_t> ia(s, N2);
+    v1[ia] &= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  1);
+    assert(v1[ 4] ==  0);
+    assert(v1[ 5] ==  1);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  4);
+    assert(v1[ 8] ==  0);
+    assert(v1[ 9] ==  0);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  3);
+    assert(v1[12] ==  8);
+    assert(v1[13] ==  9);
+    assert(v1[14] == 14);
+    assert(v1[15] == 10);
+    assert(v1[16] ==  0);
+    assert(v1[17] ==  0);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] ==  4);
+    assert(v1[23] ==  6);
+    assert(v1[24] ==  8);
+    assert(v1[25] == 25);
+    assert(v1[26] == 16);
+    assert(v1[27] == 17);
+    assert(v1[28] == 16);
+    assert(v1[29] == 29);
+    assert(v1[30] == 18);
+    assert(v1[31] == 20);
+    assert(v1[32] ==  0);
+    assert(v1[33] == 33);
+    assert(v1[34] ==  2);
+    assert(v1[35] ==  3);
+    assert(v1[36] ==  0);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/divide.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/divide.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/divide.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/divide.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class indirect_array
+
+// void operator/=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    std::size_t s[N2] = { 3,  4,  5,  7,  8,  9, 11, 12, 13, 15, 16, 17,
+                         22, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    std::valarray<std::size_t> ia(s, N2);
+    v1[ia] /= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  3);
+    assert(v1[ 4] ==  2);
+    assert(v1[ 5] ==  1);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  1);
+    assert(v1[ 8] ==  1);
+    assert(v1[ 9] ==  1);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  1);
+    assert(v1[12] ==  1);
+    assert(v1[13] ==  1);
+    assert(v1[14] == 14);
+    assert(v1[15] ==  1);
+    assert(v1[16] ==  1);
+    assert(v1[17] ==  1);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] ==  1);
+    assert(v1[23] ==  1);
+    assert(v1[24] ==  1);
+    assert(v1[25] == 25);
+    assert(v1[26] ==  1);
+    assert(v1[27] ==  1);
+    assert(v1[28] ==  1);
+    assert(v1[29] == 29);
+    assert(v1[30] ==  1);
+    assert(v1[31] ==  1);
+    assert(v1[32] ==  1);
+    assert(v1[33] == 33);
+    assert(v1[34] ==  1);
+    assert(v1[35] ==  1);
+    assert(v1[36] ==  1);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/modulo.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/modulo.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/modulo.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/modulo.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class indirect_array
+
+// void operator%=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    std::size_t s[N2] = { 3,  4,  5,  7,  8,  9, 11, 12, 13, 15, 16, 17,
+                         22, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    std::valarray<std::size_t> ia(s, N2);
+    v1[ia] %= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  0);
+    assert(v1[ 4] ==  0);
+    assert(v1[ 5] ==  2);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  3);
+    assert(v1[ 8] ==  3);
+    assert(v1[ 9] ==  3);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  4);
+    assert(v1[12] ==  4);
+    assert(v1[13] ==  4);
+    assert(v1[14] == 14);
+    assert(v1[15] ==  5);
+    assert(v1[16] ==  5);
+    assert(v1[17] ==  5);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] ==  9);
+    assert(v1[23] ==  9);
+    assert(v1[24] ==  9);
+    assert(v1[25] == 25);
+    assert(v1[26] == 10);
+    assert(v1[27] == 10);
+    assert(v1[28] == 10);
+    assert(v1[29] == 29);
+    assert(v1[30] == 11);
+    assert(v1[31] == 11);
+    assert(v1[32] == 11);
+    assert(v1[33] == 33);
+    assert(v1[34] == 12);
+    assert(v1[35] == 12);
+    assert(v1[36] == 12);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/multiply.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/multiply.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/multiply.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/multiply.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class indirect_array
+
+// void operator*=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    std::size_t s[N2] = { 3,  4,  5,  7,  8,  9, 11, 12, 13, 15, 16, 17,
+                         22, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    std::valarray<std::size_t> ia(s, N2);
+    v1[ia] *= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  3);
+    assert(v1[ 4] ==  8);
+    assert(v1[ 5] == 15);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] == 28);
+    assert(v1[ 8] == 40);
+    assert(v1[ 9] == 54);
+    assert(v1[10] == 10);
+    assert(v1[11] == 77);
+    assert(v1[12] == 96);
+    assert(v1[13] == 117);
+    assert(v1[14] == 14);
+    assert(v1[15] == 150);
+    assert(v1[16] == 176);
+    assert(v1[17] == 204);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] == 286);
+    assert(v1[23] == 322);
+    assert(v1[24] == 360);
+    assert(v1[25] == 25);
+    assert(v1[26] == 416);
+    assert(v1[27] == 459);
+    assert(v1[28] == 504);
+    assert(v1[29] == 29);
+    assert(v1[30] == 570);
+    assert(v1[31] == 620);
+    assert(v1[32] == 672);
+    assert(v1[33] == 33);
+    assert(v1[34] == 748);
+    assert(v1[35] == 805);
+    assert(v1[36] == 864);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/or.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/or.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/or.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/or.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class indirect_array
+
+// void operator|=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    std::size_t s[N2] = { 3,  4,  5,  7,  8,  9, 11, 12, 13, 15, 16, 17,
+                         22, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    std::valarray<std::size_t> ia(s, N2);
+    v1[ia] |= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  3);
+    assert(v1[ 4] ==  6);
+    assert(v1[ 5] ==  7);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  7);
+    assert(v1[ 8] == 13);
+    assert(v1[ 9] == 15);
+    assert(v1[10] == 10);
+    assert(v1[11] == 15);
+    assert(v1[12] == 12);
+    assert(v1[13] == 13);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15);
+    assert(v1[16] == 27);
+    assert(v1[17] == 29);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] == 31);
+    assert(v1[23] == 31);
+    assert(v1[24] == 31);
+    assert(v1[25] == 25);
+    assert(v1[26] == 26);
+    assert(v1[27] == 27);
+    assert(v1[28] == 30);
+    assert(v1[29] == 29);
+    assert(v1[30] == 31);
+    assert(v1[31] == 31);
+    assert(v1[32] == 53);
+    assert(v1[33] == 33);
+    assert(v1[34] == 54);
+    assert(v1[35] == 55);
+    assert(v1[36] == 60);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/shift_left.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/shift_left.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/shift_left.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/shift_left.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class indirect_array
+
+// void operator<<=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    std::size_t s[N2] = { 3,  4,  5,  7,  8,  9, 11, 12, 13, 15, 16, 17,
+                         22, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    std::valarray<std::size_t> ia(s, N2);
+    v1[ia] <<= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  6);
+    assert(v1[ 4] == 16);
+    assert(v1[ 5] == 40);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] == 112);
+    assert(v1[ 8] == 256);
+    assert(v1[ 9] == 576);
+    assert(v1[10] == 10);
+    assert(v1[11] == 1408);
+    assert(v1[12] == 3072);
+    assert(v1[13] == 6656);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15360);
+    assert(v1[16] == 32768);
+    assert(v1[17] == 69632);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] == 180224);
+    assert(v1[23] == 376832);
+    assert(v1[24] == 786432);
+    assert(v1[25] == 25);
+    assert(v1[26] == 1703936);
+    assert(v1[27] == 3538944);
+    assert(v1[28] == 7340032);
+    assert(v1[29] == 29);
+    assert(v1[30] == 15728640);
+    assert(v1[31] == 32505856);
+    assert(v1[32] == 67108864);
+    assert(v1[33] == 33);
+    assert(v1[34] == 142606336);
+    assert(v1[35] == 293601280);
+    assert(v1[36] == 603979776);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/shift_right.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/shift_right.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/shift_right.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/shift_right.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class indirect_array
+
+// void operator>>=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    std::size_t s[N2] = { 3,  4,  5,  7,  8,  9, 11, 12, 13, 15, 16, 17,
+                         22, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    std::valarray<std::size_t> ia(s, N2);
+    v1[ia] >>= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  1);
+    assert(v1[ 4] ==  1);
+    assert(v1[ 5] ==  0);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  0);
+    assert(v1[ 8] ==  0);
+    assert(v1[ 9] ==  0);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  0);
+    assert(v1[12] ==  0);
+    assert(v1[13] ==  0);
+    assert(v1[14] == 14);
+    assert(v1[15] ==  0);
+    assert(v1[16] ==  0);
+    assert(v1[17] ==  0);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] ==  0);
+    assert(v1[23] ==  0);
+    assert(v1[24] ==  0);
+    assert(v1[25] == 25);
+    assert(v1[26] ==  0);
+    assert(v1[27] ==  0);
+    assert(v1[28] ==  0);
+    assert(v1[29] == 29);
+    assert(v1[30] ==  0);
+    assert(v1[31] ==  0);
+    assert(v1[32] ==  0);
+    assert(v1[33] == 33);
+    assert(v1[34] ==  0);
+    assert(v1[35] ==  0);
+    assert(v1[36] ==  0);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/subtraction.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/subtraction.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/subtraction.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/subtraction.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class indirect_array
+
+// void operator-=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    std::size_t s[N2] = { 3,  4,  5,  7,  8,  9, 11, 12, 13, 15, 16, 17,
+                         22, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    std::valarray<std::size_t> ia(s, N2);
+    v1[ia] -= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  2);
+    assert(v1[ 4] ==  2);
+    assert(v1[ 5] ==  2);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  3);
+    assert(v1[ 8] ==  3);
+    assert(v1[ 9] ==  3);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  4);
+    assert(v1[12] ==  4);
+    assert(v1[13] ==  4);
+    assert(v1[14] == 14);
+    assert(v1[15] ==  5);
+    assert(v1[16] ==  5);
+    assert(v1[17] ==  5);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] ==  9);
+    assert(v1[23] ==  9);
+    assert(v1[24] ==  9);
+    assert(v1[25] == 25);
+    assert(v1[26] == 10);
+    assert(v1[27] == 10);
+    assert(v1[28] == 10);
+    assert(v1[29] == 29);
+    assert(v1[30] == 11);
+    assert(v1[31] == 11);
+    assert(v1[32] == 11);
+    assert(v1[33] == 33);
+    assert(v1[34] == 12);
+    assert(v1[35] == 12);
+    assert(v1[36] == 12);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/xor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/xor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/xor.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.comp.assign/xor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class indirect_array
+
+// void operator^=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
+                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    std::size_t s[N2] = { 3,  4,  5,  7,  8,  9, 11, 12, 13, 15, 16, 17,
+                         22, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    std::valarray<std::size_t> ia(s, N2);
+    v1[ia] ^= v2;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  2);
+    assert(v1[ 4] ==  6);
+    assert(v1[ 5] ==  6);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  3);
+    assert(v1[ 8] == 13);
+    assert(v1[ 9] == 15);
+    assert(v1[10] == 10);
+    assert(v1[11] == 12);
+    assert(v1[12] ==  4);
+    assert(v1[13] ==  4);
+    assert(v1[14] == 14);
+    assert(v1[15] ==  5);
+    assert(v1[16] == 27);
+    assert(v1[17] == 29);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] == 27);
+    assert(v1[23] == 25);
+    assert(v1[24] == 23);
+    assert(v1[25] == 25);
+    assert(v1[26] == 10);
+    assert(v1[27] == 10);
+    assert(v1[28] == 14);
+    assert(v1[29] == 29);
+    assert(v1[30] == 13);
+    assert(v1[31] == 11);
+    assert(v1[32] == 53);
+    assert(v1[33] == 33);
+    assert(v1[34] == 52);
+    assert(v1[35] == 52);
+    assert(v1[36] == 60);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.fill/assign_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.fill/assign_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.fill/assign_value.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.indirect.array/indirect.array.fill/assign_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class indirect_array
+
+// void operator=(const value_type& x) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+                36, 37, 38, 39, 40};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    std::size_t s[] = { 3,  4,  5,  7,  8,  9, 11, 12, 13, 15, 16, 17,
+                       22, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36};
+    const std::size_t S = sizeof(s)/sizeof(s[0]);
+    std::valarray<int> v1(a1, N1);
+    std::valarray<std::size_t> ia(s, S);
+    v1[ia] = 51;
+    assert(v1.size() == 41);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] == 51);
+    assert(v1[ 4] == 51);
+    assert(v1[ 5] == 51);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] == 51);
+    assert(v1[ 8] == 51);
+    assert(v1[ 9] == 51);
+    assert(v1[10] == 10);
+    assert(v1[11] == 51);
+    assert(v1[12] == 51);
+    assert(v1[13] == 51);
+    assert(v1[14] == 14);
+    assert(v1[15] == 51);
+    assert(v1[16] == 51);
+    assert(v1[17] == 51);
+    assert(v1[18] == 18);
+    assert(v1[19] == 19);
+    assert(v1[20] == 20);
+    assert(v1[21] == 21);
+    assert(v1[22] == 51);
+    assert(v1[23] == 51);
+    assert(v1[24] == 51);
+    assert(v1[25] == 25);
+    assert(v1[26] == 51);
+    assert(v1[27] == 51);
+    assert(v1[28] == 51);
+    assert(v1[29] == 29);
+    assert(v1[30] == 51);
+    assert(v1[31] == 51);
+    assert(v1[32] == 51);
+    assert(v1[33] == 33);
+    assert(v1[34] == 51);
+    assert(v1[35] == 51);
+    assert(v1[36] == 51);
+    assert(v1[37] == 37);
+    assert(v1[38] == 38);
+    assert(v1[39] == 39);
+    assert(v1[40] == 40);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.indirect.array/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.indirect.array/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.indirect.array/types.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.indirect.array/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T>
+// class indirect_array
+// {
+// public:
+//     typedef T value_type;
+
+#include <valarray>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::indirect_array<int>::value_type, int>::value), "");
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.mask.array/default.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.mask.array/default.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.mask.array/default.fail.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.mask.array/default.fail.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class mask_array
+
+// mask_array() = delete;
+
+#include <valarray>
+#include <type_traits>
+
+int main()
+{
+    std::mask_array<int> s;
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.assign/mask_array.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.assign/mask_array.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.assign/mask_array.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.assign/mask_array.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class mask_array
+
+// void mask_array& operator=(const mask_array& ma) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    {
+    int a1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    bool b1[N1] = {true,  false, false, true,  true,  false,
+                   false, true,  false, false, false, true};
+    int a2[] = {-1, -2, -3, -4, -5, -6, -7, -8};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    bool b2[N2] = {true,  false, true, true,
+                   false, false, true, true};
+    std::valarray<int> v1(a1, N1);
+    const std::valarray<int> v2(a2, N2);
+    std::valarray<bool> vb1(b1, N1);
+    std::valarray<bool> vb2(b2, N2);
+    v1[vb1] = v2[vb2];
+    assert(v1.size() == 16);
+    assert(v1[ 0] == -1);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] == -3);
+    assert(v1[ 4] == -4);
+    assert(v1[ 5] ==  5);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] == -7);
+    assert(v1[ 8] ==  8);
+    assert(v1[ 9] ==  9);
+    assert(v1[10] == 10);
+    assert(v1[11] == -8);
+    assert(v1[12] == 12);
+    assert(v1[13] == 13);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15);
+    }
+    // Test return value of assignment
+    {
+    int a1[] = {0, 1, 2};
+    int a2[] = {3, 4, 5};
+    bool b1[] = {true, false, true};
+    std::valarray<int> v1(a1, 3);
+    std::valarray<int> v2(a2, 3);
+    std::valarray<bool> const vb1(b1, 3);
+    std::mask_array<int> m1 = v1[vb1];
+    std::mask_array<int> const m2 = v2[vb1];
+    std::mask_array<int> const & r = (m1 = m2);
+    assert(&r == &m1);
+    }
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.assign/valarray.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.assign/valarray.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.assign/valarray.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.assign/valarray.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class mask_array
+
+// void operator=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {1, 2, 3, 4, 5};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    bool b[N1] = {true,  false, false, true,  true,  false,
+                  false, true,  false, false, false, true};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    assert(N2 == std::count(b, b+N1, true));
+    std::valarray<bool> vb(b, N1);
+    v1[vb] = v2;
+    assert(v1.size() == 16);
+    assert(v1[ 0] ==  1);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  2);
+    assert(v1[ 4] ==  3);
+    assert(v1[ 5] ==  5);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  4);
+    assert(v1[ 8] ==  8);
+    assert(v1[ 9] ==  9);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  5);
+    assert(v1[12] == 12);
+    assert(v1[13] == 13);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/addition.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/addition.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/addition.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/addition.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class mask_array
+
+// void operator+=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {1, 2, 3, 4, 5};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    bool b[N1] = {true,  false, false, true,  true,  false,
+                  false, true,  false, false, false, true};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    assert(N2 == std::count(b, b+N1, true));
+    std::valarray<bool> vb(b, N1);
+    v1[vb] += v2;
+    assert(v1.size() == 16);
+    assert(v1[ 0] ==  1);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  5);
+    assert(v1[ 4] ==  7);
+    assert(v1[ 5] ==  5);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] == 11);
+    assert(v1[ 8] ==  8);
+    assert(v1[ 9] ==  9);
+    assert(v1[10] == 10);
+    assert(v1[11] == 16);
+    assert(v1[12] == 12);
+    assert(v1[13] == 13);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/and.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/and.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/and.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/and.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class mask_array
+
+// void operator&=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {1, 2, 3, 4, 5};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    bool b[N1] = {true,  false, false, true,  true,  false,
+                  false, true,  false, false, false, true};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    assert(N2 == std::count(b, b+N1, true));
+    std::valarray<bool> vb(b, N1);
+    v1[vb] &= v2;
+    assert(v1.size() == 16);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  2);
+    assert(v1[ 4] ==  0);
+    assert(v1[ 5] ==  5);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  4);
+    assert(v1[ 8] ==  8);
+    assert(v1[ 9] ==  9);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  1);
+    assert(v1[12] == 12);
+    assert(v1[13] == 13);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/divide.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/divide.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/divide.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/divide.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class mask_array
+
+// void operator/=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {1, 2, 3, 4, 5};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    bool b[N1] = {true,  false, false, true,  true,  false,
+                  false, true,  false, false, false, true};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    assert(N2 == std::count(b, b+N1, true));
+    std::valarray<bool> vb(b, N1);
+    v1[vb] /= v2;
+    assert(v1.size() == 16);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  1);
+    assert(v1[ 4] ==  1);
+    assert(v1[ 5] ==  5);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  1);
+    assert(v1[ 8] ==  8);
+    assert(v1[ 9] ==  9);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  2);
+    assert(v1[12] == 12);
+    assert(v1[13] == 13);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/modulo.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/modulo.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/modulo.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/modulo.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class mask_array
+
+// void operator%=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {1, 2, 3, 4, 5};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    bool b[N1] = {true,  false, false, true,  true,  false,
+                  false, true,  false, false, false, true};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    assert(N2 == std::count(b, b+N1, true));
+    std::valarray<bool> vb(b, N1);
+    v1[vb] %= v2;
+    assert(v1.size() == 16);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  1);
+    assert(v1[ 4] ==  1);
+    assert(v1[ 5] ==  5);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  3);
+    assert(v1[ 8] ==  8);
+    assert(v1[ 9] ==  9);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  1);
+    assert(v1[12] == 12);
+    assert(v1[13] == 13);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/multiply.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/multiply.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/multiply.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/multiply.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class mask_array
+
+// void operator*=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {1, 2, 3, 4, 5};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    bool b[N1] = {true,  false, false, true,  true,  false,
+                  false, true,  false, false, false, true};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    assert(N2 == std::count(b, b+N1, true));
+    std::valarray<bool> vb(b, N1);
+    v1[vb] *= v2;
+    assert(v1.size() == 16);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  6);
+    assert(v1[ 4] == 12);
+    assert(v1[ 5] ==  5);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] == 28);
+    assert(v1[ 8] ==  8);
+    assert(v1[ 9] ==  9);
+    assert(v1[10] == 10);
+    assert(v1[11] == 55);
+    assert(v1[12] == 12);
+    assert(v1[13] == 13);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/or.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/or.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/or.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/or.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class mask_array
+
+// void operator|=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {1, 2, 3, 4, 5};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    bool b[N1] = {true,  false, false, true,  true,  false,
+                  false, true,  false, false, false, true};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    assert(N2 == std::count(b, b+N1, true));
+    std::valarray<bool> vb(b, N1);
+    v1[vb] |= v2;
+    assert(v1.size() == 16);
+    assert(v1[ 0] ==  1);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  3);
+    assert(v1[ 4] ==  7);
+    assert(v1[ 5] ==  5);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  7);
+    assert(v1[ 8] ==  8);
+    assert(v1[ 9] ==  9);
+    assert(v1[10] == 10);
+    assert(v1[11] == 15);
+    assert(v1[12] == 12);
+    assert(v1[13] == 13);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/shift_left.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/shift_left.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/shift_left.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/shift_left.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class mask_array
+
+// void operator<<=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {1, 2, 3, 4, 5};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    bool b[N1] = {true,  false, false, true,  true,  false,
+                  false, true,  false, false, false, true};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    assert(N2 == std::count(b, b+N1, true));
+    std::valarray<bool> vb(b, N1);
+    v1[vb] <<= v2;
+    assert(v1.size() == 16);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] == 12);
+    assert(v1[ 4] == 32);
+    assert(v1[ 5] ==  5);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] == 112);
+    assert(v1[ 8] ==  8);
+    assert(v1[ 9] ==  9);
+    assert(v1[10] == 10);
+    assert(v1[11] == 352);
+    assert(v1[12] == 12);
+    assert(v1[13] == 13);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/shift_right.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/shift_right.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/shift_right.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/shift_right.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class mask_array
+
+// void operator>>=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {1, 2, 3, 4, 5};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    bool b[N1] = {true,  false, false, true,  true,  false,
+                  false, true,  false, false, false, true};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    assert(N2 == std::count(b, b+N1, true));
+    std::valarray<bool> vb(b, N1);
+    v1[vb] >>= v2;
+    assert(v1.size() == 16);
+    assert(v1[ 0] ==  0);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  0);
+    assert(v1[ 4] ==  0);
+    assert(v1[ 5] ==  5);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  0);
+    assert(v1[ 8] ==  8);
+    assert(v1[ 9] ==  9);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  0);
+    assert(v1[12] == 12);
+    assert(v1[13] == 13);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/subtraction.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/subtraction.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/subtraction.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/subtraction.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class mask_array
+
+// void operator-=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {1, 2, 3, 4, 5};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    bool b[N1] = {true,  false, false, true,  true,  false,
+                  false, true,  false, false, false, true};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    assert(N2 == std::count(b, b+N1, true));
+    std::valarray<bool> vb(b, N1);
+    v1[vb] -= v2;
+    assert(v1.size() == 16);
+    assert(v1[ 0] == -1);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  1);
+    assert(v1[ 4] ==  1);
+    assert(v1[ 5] ==  5);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  3);
+    assert(v1[ 8] ==  8);
+    assert(v1[ 9] ==  9);
+    assert(v1[10] == 10);
+    assert(v1[11] ==  6);
+    assert(v1[12] == 12);
+    assert(v1[13] == 13);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/xor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/xor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/xor.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.comp.assign/xor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class mask_array
+
+// void operator^=(const valarray<value_type>& v) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    int a2[] = {1, 2, 3, 4, 5};
+    const std::size_t N2 = sizeof(a2)/sizeof(a2[0]);
+    bool b[N1] = {true,  false, false, true,  true,  false,
+                  false, true,  false, false, false, true};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<int> v2(a2, N2);
+    assert(N2 == std::count(b, b+N1, true));
+    std::valarray<bool> vb(b, N1);
+    v1[vb] ^= v2;
+    assert(v1.size() == 16);
+    assert(v1[ 0] ==  1);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] ==  1);
+    assert(v1[ 4] ==  7);
+    assert(v1[ 5] ==  5);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] ==  3);
+    assert(v1[ 8] ==  8);
+    assert(v1[ 9] ==  9);
+    assert(v1[10] == 10);
+    assert(v1[11] == 14);
+    assert(v1[12] == 12);
+    assert(v1[13] == 13);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.fill/assign_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.fill/assign_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.fill/assign_value.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.mask.array/mask.array.fill/assign_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class mask_array
+
+// void operator=(const value_type& x) const;
+
+#include <valarray>
+#include <cassert>
+
+int main()
+{
+    int a1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+    const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
+    bool b[N1] = {true,  false, false, true,  true,  false,
+                  false, true,  false, false, false, true};
+    std::valarray<int> v1(a1, N1);
+    std::valarray<bool> vb(b, N1);
+    v1[vb] = -5;
+    assert(v1.size() == 16);
+    assert(v1[ 0] == -5);
+    assert(v1[ 1] ==  1);
+    assert(v1[ 2] ==  2);
+    assert(v1[ 3] == -5);
+    assert(v1[ 4] == -5);
+    assert(v1[ 5] ==  5);
+    assert(v1[ 6] ==  6);
+    assert(v1[ 7] == -5);
+    assert(v1[ 8] ==  8);
+    assert(v1[ 9] ==  9);
+    assert(v1[10] == 10);
+    assert(v1[11] == -5);
+    assert(v1[12] == 12);
+    assert(v1[13] == 13);
+    assert(v1[14] == 14);
+    assert(v1[15] == 15);
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.mask.array/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.mask.array/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.mask.array/types.pass.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.mask.array/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T>
+// class mask_array
+// {
+// public:
+//     typedef T value_type;
+
+#include <valarray>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::mask_array<int>::value_type, int>::value), "");
+}

Added: libcxx/trunk/test/std/numerics/numarray/template.slice.array/default.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numarray/template.slice.array/default.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/numerics/numarray/template.slice.array/default.fail.cpp (added)
+++ libcxx/trunk/test/std/numerics/numarray/template.slice.array/default.fail.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template <class T> class slice_array
+
+// slice_array() = delete;
+
+#include <valarray>
+#include <type_traits>
+
+int main()
+{
+    std::slice_array<int> s;
+}





More information about the cfe-commits mailing list