Commit Graph

146 Commits

Author SHA1 Message Date
Eric Fiselier
514c831504 Remove possible trailing padding from aligned_storage. Patch from Yiran Wang
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@248309 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-22 18:37:03 +00:00
Eric Fiselier
65a6f64221 make common_type SFINAE-friendly and support void. Patch from Agustin Berge.
This patch also fixes PR22135. (https://llvm.org/bugs/show_bug.cgi?id=22135)
See the review for more information: http://reviews.llvm.org/D6964


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246977 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-08 00:13:57 +00:00
Marshall Clow
6d9da5891f Remove unused code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246445 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 14:43:41 +00:00
Eric Fiselier
cae4caba73 Move __lazy_* metafunctions to type traits and add tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246408 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 03:50:31 +00:00
Joerg Sonnenberger
ba865ff66b Protect template argument from user interference.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@244462 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 16:58:04 +00:00
Nick Lewycky
e1be30b7e1 Fix typo in unused variable name.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243586 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-29 22:38:23 +00:00
Eric Fiselier
12c6d9cd93 [libcxx] Get is_*_destructible tests passing in C++03.
Summary: This patch adds proper guards to the is_destructible tests depending on the standard version so that they pass in c++03.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D10047

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@242612 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-18 16:43:58 +00:00
Eric Fiselier
4983580dc5 Cleanup result_of tests and fix issues with the C++03 result_of.
The two main fixes this patch contains are:
- use __identity_t instead of common_type. common_type was used as an
  identity metafunction but the decay resulted in incorrect results.
- Pointers to free functions were not counted as functions. Remove the pointer
  before checking if a type is a function.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@239668 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-13 08:25:24 +00:00
Eric Fiselier
3a0e430cd4 [libcxx] Fix detection of __is_final.
Summary: Currently we only enable the use of __is_final(...) with Clang. GCC also provides __is_final(...) since 4.7 in all standard modes. This patch creates the macro _LIBCPP_HAS_IS_FINAL to note the availability of `__is_final`.

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8795

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@239664 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-13 07:08:02 +00:00
Eric Fiselier
b7fc49f828 Make __void_t unary and always provide it.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@239655 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-13 02:36:07 +00:00
Eric Fiselier
eeeada1c77 Enable __is_trivially* intrinsics for GCC 5.1
Until GCC 5.1 the __is_trivially* intrinsics were not provided. Enable use of
the builtins for GCC 5.1.

Also enable Reference qualified member functions for GCC 4.9 and greater.

This patch also defines _GNUC_VER to 0 when __GNUC__ is not defined because
libc++ assumes _GNUC_VER is always defined.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@239653 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-13 02:18:44 +00:00
Eric Fiselier
724b5ab350 Refactor is_member_function_pointer to use is_function and not __member_function_traits.
Replacing the dependancy on __member_function_traits with is_function allows
is_member_function_pointer to work more often. In particular it allows it to
work when we don't have variadic templates but the function has an arity > 3.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@239649 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-13 00:33:13 +00:00
Marshall Clow
e62560a9b6 Add support for N4389 - std::bool_constant
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237636 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 23:21:06 +00:00
Eric Fiselier
c254b36c29 Remove constexpr support for std::apply because it introduces regressions.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@235274 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-19 15:32:52 +00:00
Marshall Clow
3a4964aef3 Qualify an internal call in is_assignable to prevent ADL lookup, which would 'complete' an type definition unnecessarily. Thanks to Richard Smith for the report.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@234886 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-14 13:53:53 +00:00
Eric Fiselier
4bd15469a9 [libcxx] Fix PR22771 - Support access control SFINAE in the library version of is_convertible.
Summary:
Currently the conversion check does not take place in a context where access control SFINAE is applied. This patch changes the context of the test expression so that SFINAE occurs if access control does not permit the conversion.

Related bug: https://llvm.org/bugs/show_bug.cgi?id=22771

Reviewers: mclow.lists, rsmith, dim

Reviewed By: dim

Subscribers: dim, rodrigc, emaste, cfe-commits

Differential Revision: http://reviews.llvm.org/D8461

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233552 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 15:22:20 +00:00
Eric Fiselier
ffbfbcda66 Create macro to allow testing of is_convertible without the compiler builtin.
Summary: This patch also fixes one test case that failed in the library version of is_convertible.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8456

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232764 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-19 21:11:02 +00:00
Eric Fiselier
13858ee056 [libcxx] Add <experimental/tuple> header for LFTS.
Summary:
This patch adds the `<experimental/tuple>` header (almost) as specified in the latest draft of the library fundamentals TS.

The main changes in this patch are:

1. Added variable template `tuple_size_v`
2. Added function `apply(Func &&, Tuple &&)`.
3. Changed `__invoke` to be `_LIBCPP_CONSTEXPR_AFTER_CXX11`.

The `apply(...)` implementation uses `__invoke` to invoke the given function. `__invoke` already provides the required functionality. Using `__invoke` also allows `apply` to be used on pointers to member function/objects as an extension. In order to facilitate this `__invoke` has to be marked `constexpr`. 



Test Plan:
Each new feature was tested. 

The test cases for `tuple_size_v` are as follows:
1. tuple_size_v.pass.cpp
  - Check `tuple_size_v` on cv qualified tuples, pairs and arrays.
2. tuple_size_v.fail.cpp
  - Test on reference type.
3. tuple_size_v_2.fail.cpp
  - Test on non-tuple
4. tuple_size_v_3.fail.cpp
  - Test on pointer type.

The test cases for tuple.apply are as follows:

1. arg_type.pass.cpp
   - Ensure that ref/pointer/cv qualified types are properly passed.
2. constexpr_types.pass.cpp
   - Ensure constexpr evaluation of apply is possible for `tuple` and `pair`.
3. extended_types.pass.cpp
   - Test apply on function types permitted by extension.
4. large_arity.pass.cpp
   - Test that apply can evaluated on tuples and arrays with large sizes.
5. ref_qualifiers.pass.cpp
   - Test that apply respects ref qualified functions.
6. return_type.pass.cpp
   - Test that apply returns the proper type.
7. types.pass.cpp
   - Test apply on function types as required by LFTS.

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4512

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232515 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-17 18:28:14 +00:00
Eric Fiselier
da1818a08c [libc++] Try and prevent evaluation of is_default_constructible on tuples default constructor if it is not needed.
Summary:
Currently parts of the SFINAE on tuples default constructor always gets evaluated even when the default constructor is never called or instantiated. This can cause a hard compile error when a tuple is created with types that do not have a default constructor. Below is a self contained example using a pair like class. This code will not compile but probably should.

```

#include <type_traits>

template <class T>
struct IllFormedDefaultImp {
    IllFormedDefaultImp(T x) : value(x) {}
    constexpr IllFormedDefaultImp() {}
    T value;
};

typedef IllFormedDefaultImp<int &> IllFormedDefault;

template <class T, class U>
struct pair
{
  template <bool Dummy = true,
    class = typename std::enable_if<
         std::is_default_constructible<T>::value
      && std::is_default_constructible<U>::value
      && Dummy>::type
    >
  constexpr pair() : first(), second() {}

  pair(T const & t, U const & u) : first(t), second(u) {}

  T first;
  U second;
};

int main()
{
  int x = 1;
  IllFormedDefault v(x);
  pair<IllFormedDefault, IllFormedDefault> p(v, v);
}
```

One way to fix this is to use `Dummy` in a more involved way in the constructor SFINAE. The following patch fixes these sorts of hard compile errors for tuple.


Reviewers: mclow.lists, rsmith, K-ballo, EricWF

Reviewed By: EricWF

Subscribers: ldionne, cfe-commits

Differential Revision: http://reviews.llvm.org/D7569

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@230120 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-21 02:30:41 +00:00
Eric Fiselier
89465dce7c [libc++] Fix PR20084 - std::is_function<void() const> failed.
Summary:
This patch introduces some black magic to detect const and volatile qualified function types such as `void () const`.

The patch works in the following way:

We first rule out any type that satisfies on of the following. These restrictions are important so that the test below works properly.
* `is_class<_Tp>::value`
* `is_union<_Tp>::value`
* `is_void<_Tp>::value`
* `is_reference<_Tp>::value`
* `__is_nullptr_t<_Tp>::value`


If none of the above is true we perform overload resolution on `__source<_Tp>(0)` to determine the return type.
*  If `_Tp&` is well-formed we select `_Tp& __source(int)`. `_Tp&` is only ill formed for cv void types and cv/ref qualified function types.
* Otherwise we select `__dummy_type __source(...)`. Since we know `_Tp` cannot be void then it must be a function type.


let `R` be the returned from `__source<_Tp>(0)`. 
We perform overload resolution on `__test<_Tp>(R)`.
* If `R` is `__dummy_type` we call `true_type __test(__dummy_type)`.
* if `R` is `_Tp&` and `_Tp&` decays to `_Tp*` we call `true_type __test(_Tp*)`.  Only references to function types decay to a pointer of the same type.
* In all other cases we call `false_type __test(...)`. 

`__source<_Tp>(0)` will try and form `_Tp&`  in the return type. if `_Tp&` is not well formed the return type of `__source<_Tp>(0)` will be dummy type. `_Tp&` is only ill-formed for cv/ref qualified function types (and void which is dealt with elsewhere).


This fixes PR20084 - http://llvm.org/bugs/show_bug.cgi?id=20084

Reviewers: rsmith, K-ballo, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7573

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@229696 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-18 16:31:46 +00:00
Eric Fiselier
31cb7fe75e [libcxx] Properly convert the count arguments to the *_n algorithms before use.
Summary:
The requirement on the `Size` type passed to *_n algorithms is that it is convertible to an integral type. This means we can't use a variable of type `Size` directly. Instead we need to convert it to an integral type first.  The problem is finding out what integral type to convert it to.  `__convert_to_integral` figures out what integral type to convert it to and performs the conversion, It also promotes the resulting integral type so that it is at least as big as an integer. `__convert_to_integral` also has a special case for converting enums. This should only work on non-scoped enumerations because it does not apply an explicit conversion from the enum to its underlying type.



Reviewers: chandlerc, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7449

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@228704 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-10 16:46:42 +00:00
Marshall Clow
6027993c28 K-Ballo found a place where we were using 'V' as a template parameter. Replace with '_Vp' for protection against user-defined macros.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225527 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 17:03:36 +00:00
Marshall Clow
88aae920ef Implement void_t from N3911. Add a private version for use in the library before C++1z. Update the 1z status page, marking a bunch of issues that don't require library changes as complete (2129, 2212, 2230, 2233, 2325, 2365, 2376)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222138 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 15:50:08 +00:00
Eric Fiselier
b6e0ef2deb Fix rvalue bug in __has_operator_addressof
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221398 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-05 21:20:10 +00:00
Eric Fiselier
341b59021c Fix operator & detection trait to check for free function overloads as well
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221395 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-05 20:59:18 +00:00
Marshall Clow
38d9005902 Whitespace maintenance. Remove a bunch of tabs that snuck in. No functionality change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220142 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-18 11:03:33 +00:00
Eric Fiselier
950ee77d24 [libcxx] Fix SFINAE in <cmath>. Patch from K-Ballo.
Delay instantiation of `__numeric_type` within <cmath>, 
don't instantiate it when the `is_arithmetic` conditions do not hold as it causes
errors with user-defined types with ambiguous conversions. Fixes PR21083.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@219998 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-17 00:31:47 +00:00
Marshall Clow
df9722ecf1 Fix for PR 19616: 'tuple_cat of nested tuples fails in noexcept specification'. Thanks to Louis Dionne for the fix.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@219243 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-07 21:42:12 +00:00
Marshall Clow
d132bf4ef1 Fix some type-traits (is_assignable, etc) dealing with classes that take non-const references as 'right hand side'. Add tests. Fixes PR# 20836
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@218286 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-22 23:58:00 +00:00
Marshall Clow
e33e03e558 Fix PR#20834 - 'is_trivially_destructible yeilds wrong answer for arrays of unknown bound' Thanks to K-ballo for the bug report. Update a few of the other tests while we're here, and fix a typo in a test name.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@216909 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-02 16:19:38 +00:00
Eric Fiselier
63648cffc0 Fix is_member_function_pointer does not account for ellipsis. PR20345. Patch from Agustin Berge.
I reviewed the patch and added the test cases.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@215984 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-19 16:31:47 +00:00
Eric Fiselier
6f8821df70 [libcxx] Remove use of default function template parameters in type traits. Fixes DR20484
Summary: This patch moves the SFINAE for __is_destructor_welformed out of the function template parameters. type_traits must compile in c++03 mode since it is included in c++03 headers. 

Test Plan: No tests have been added.

Reviewers: danalbert, mclow.lists

Reviewed By: danalbert

Subscribers: K-ballo, cfe-commits

Differential Revision: http://reviews.llvm.org/D4735

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@214422 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-31 19:09:26 +00:00
Marshall Clow
2b44e3dd49 Correctly implement LWG 2049; std::is_destructible.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@213163 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-16 15:51:50 +00:00
Marshall Clow
48e7e9f403 Support the built-in type-trait support in gcc 4.7 and later. Thanks to Albert Wong for the patch.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@212727 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-10 15:38:20 +00:00
Marshall Clow
81aa3a745c Patch from Albert J. Wong to make type_traits take advantage of gcc intrinsics in 4.7 and later. No functionality change when using clang.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@211755 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-26 01:07:56 +00:00
Marshall Clow
4f3368e269 Fix a problem exposed by r208825, which caused bind (and other bits of libc++) to stop working. And tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@209785 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-29 01:10:28 +00:00
Marshall Clow
067e91d29e Use compiler intrinsic __is_constructible if available
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@206805 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-21 22:30:32 +00:00
Stephan Tolksdorf
8a71d23633 [libc++] Teach is_integral, is_[un]signed and make_[un]signed about __[u]int128_t
This commit also adds tests for std::numeric_limits<__[u]int128_t>.

Reviewed in http://llvm-reviews.chandlerc.com/D2917

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@204849 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 19:45:52 +00:00
Marshall Clow
24b29a02f1 Mark is_final as a C++14 feature.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202991 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 17:58:48 +00:00
Marshall Clow
ebd6c2b81d Implement LWG #2212: std::is_final. This requires compiler support, which modern versions of clang provide. Also mark LWG #2230 as complete - no code changes needed.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202934 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 03:39:25 +00:00
Yaron Keren
0648cc5316 Solve the errors
Error 1 error C2681: 'add_rvalue_reference<_Tp*>::type' : invalid expression
type for dynamic_cast c:\libcxx\include\type_traits

This is one more step getting libcxx compile under Visual C++. The patch is 
#if defined(_LIBCPP_MSVC) so will affect only this build.

When libcxx can be compiled, it will probably require the current version or
maybe even the next Update of Visual C++ 2013.

Patch by G M!



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201844 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-21 10:00:31 +00:00
Marshall Clow
a2df82b98e Implement LWG Issue 2346: integral_constant's member functions should be marked noexcept
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201534 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-17 22:18:51 +00:00
Marshall Clow
71e699dda5 Fix for PR17606 - result_of (and INVOKE) works incorrectly for member function pointers with ref qualifiers. Also a drive-by fix for common_type in C++03 mode. Thanks to Michel Morin for the bug report and the proposed fix.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201101 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-10 17:40:28 +00:00
Marshall Clow
708dd84a4e Rename some internal templates to avoid conflict with complier intrinsics. __is_constructible --> __libcpp_is_constructible, __is_nothrow_constructible --> __libcpp_is_nothrow_constructible, and __is_nothrow_assignable --> __libcpp_is_nothrow_assignable. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@200010 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-24 15:27:41 +00:00
Marshall Clow
8896ac3cdd Rename libc++ internal templates __is_void, __is_integral, __is_floating_point, __is_pointer, __is_function_imp, __is_function, __is_member_function_pointer, __is_member_pointer, __is_signed_impl, __is_signed, __is_unsigned_impl, __is_unsigned to __libcpp_is_XXX, because some compilers have decided that __is_XXX are keywords. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@199184 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-14 05:13:45 +00:00
Marshall Clow
0ea7f8cfb3 Rename several internal templates to get rid of ___ (triple underscores) or worse, four. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@198608 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-06 14:00:09 +00:00
Marshall Clow
854a7a02b4 Patch by Howard. First part of fix for PR18218; add type traits needed to do the right thing. Fix the problems in PR18218 for isnan and pow - they also need to be applied to the other functions in <cmath>. Also, a drive-by fix for the test - now actually calls test_abs()
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@198431 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-03 18:21:14 +00:00
Joerg Sonnenberger
bfaafd539c Don't use T as template argument, it is part of the application
namespace.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@195693 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-25 22:44:20 +00:00
Howard Hinnant
3f81e9eeba This fixes a very subtle ABI problem concerning the copy constructor of
pair, and a couple of pair-like implementation detail types.  The
C++98/03 and 11 standards all specify that the copy constructor of
pair<int, int> is trivial. However as libc++ tracked the draft C++11
standard over the years, this copy constructor became non-trivial, and
then just recently was corrected back to trivial for C++11.

Unfortunately (for libc++1) the Itanium ABI specifies different calling
conventions for trivial and non-trivial copy constructors.  Therefore
currently the C++03 libc++ copy constructor for pair<int, int> is ABI
incompatible with the C++11 libc++ copy constructor for pair<int, int>.
This is Bad(tm).   This patch corrects the situation by making this copy
constructor trivial in C++03 mode as well.

Just in case it is needed for an incomplete C++11 compiler, libc++
retains the ability to support pair with rvalue references, but without
defaulted special members.  However the pair needs non-trivial special
members to implement this special case, (as it did when clang was in
this place a couple of years ago).

During this work a bug was also found and fixed in
is_trivially_constructible.

And there is a minor drive-by fix in <__config> regarding
__type_visibility__.

A test is updated to ensure that the copy constructor of pair<int, int>
is trivial in both C++03 and C++11.  This test will necessarily fail for
a compiler that implements rvalue references but not defaulted special
members.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@194536 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-13 00:39:22 +00:00
Marshall Clow
dab89a1412 Fix LWG Issue 2141: common_type trait produces reference types
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192142 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-07 23:43:33 +00:00