mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-02 00:16:25 +00:00
Fix incorrect usage of std::is_assignable.
We want to check that we can assign to an lvalue here, not a prvalue. llvm-svn: 324152
This commit is contained in:
parent
9bbe8e68ed
commit
82aa6016a4
@ -39,16 +39,16 @@ static_assert(
|
||||
// std::is_assignable and actually writing such an assignment.
|
||||
#if !defined(_MSC_VER)
|
||||
static_assert(
|
||||
!std::is_assignable<ArrayRef<int *>, int *>::value,
|
||||
!std::is_assignable<ArrayRef<int *>&, int *>::value,
|
||||
"Assigning from single prvalue element");
|
||||
static_assert(
|
||||
!std::is_assignable<ArrayRef<int *>, int * &&>::value,
|
||||
!std::is_assignable<ArrayRef<int *>&, int * &&>::value,
|
||||
"Assigning from single xvalue element");
|
||||
static_assert(
|
||||
std::is_assignable<ArrayRef<int *>, int * &>::value,
|
||||
std::is_assignable<ArrayRef<int *>&, int * &>::value,
|
||||
"Assigning from single lvalue element");
|
||||
static_assert(
|
||||
!std::is_assignable<ArrayRef<int *>, std::initializer_list<int *>>::value,
|
||||
!std::is_assignable<ArrayRef<int *>&, std::initializer_list<int *>>::value,
|
||||
"Assigning from an initializer list");
|
||||
#endif
|
||||
|
||||
|
@ -40,22 +40,22 @@ std::ostream &operator<<(std::ostream &OS,
|
||||
// std::is_assignable and actually writing such an assignment.
|
||||
#if !defined(_MSC_VER)
|
||||
static_assert(
|
||||
!std::is_assignable<StringRef, std::string>::value,
|
||||
!std::is_assignable<StringRef&, std::string>::value,
|
||||
"Assigning from prvalue std::string");
|
||||
static_assert(
|
||||
!std::is_assignable<StringRef, std::string &&>::value,
|
||||
!std::is_assignable<StringRef&, std::string &&>::value,
|
||||
"Assigning from xvalue std::string");
|
||||
static_assert(
|
||||
std::is_assignable<StringRef, std::string &>::value,
|
||||
std::is_assignable<StringRef&, std::string &>::value,
|
||||
"Assigning from lvalue std::string");
|
||||
static_assert(
|
||||
std::is_assignable<StringRef, const char *>::value,
|
||||
std::is_assignable<StringRef&, const char *>::value,
|
||||
"Assigning from prvalue C string");
|
||||
static_assert(
|
||||
std::is_assignable<StringRef, const char * &&>::value,
|
||||
std::is_assignable<StringRef&, const char * &&>::value,
|
||||
"Assigning from xvalue C string");
|
||||
static_assert(
|
||||
std::is_assignable<StringRef, const char * &>::value,
|
||||
std::is_assignable<StringRef&, const char * &>::value,
|
||||
"Assigning from lvalue C string");
|
||||
#endif
|
||||
|
||||
|
@ -128,13 +128,13 @@ static_assert(
|
||||
// ErrorOr<int*> x(nullptr);
|
||||
// ErrorOr<std::unique_ptr<int>> y;
|
||||
// y = x; // invalid conversion
|
||||
static_assert(!std::is_assignable<ErrorOr<std::unique_ptr<int>>,
|
||||
static_assert(!std::is_assignable<ErrorOr<std::unique_ptr<int>>&,
|
||||
const ErrorOr<int *> &>::value,
|
||||
"do not invoke explicit ctors in assignment");
|
||||
|
||||
// ErrorOr<std::unique_ptr<int>> x;
|
||||
// x = ErrorOr<int*>(nullptr); // invalid conversion
|
||||
static_assert(!std::is_assignable<ErrorOr<std::unique_ptr<int>>,
|
||||
static_assert(!std::is_assignable<ErrorOr<std::unique_ptr<int>>&,
|
||||
ErrorOr<int *> &&>::value,
|
||||
"do not invoke explicit ctors in assignment");
|
||||
} // end anon namespace
|
||||
|
Loading…
Reference in New Issue
Block a user