[clang] [ARM64EC] Add support for parsing __vectorcall (PR #87725)

2024-04-16 Thread Casey Carter via cfe-commits

CaseyCarter wrote:

> @CaseyCarter It feels like we are missing an arm64ec check here, 
> https://github.com/microsoft/STL/blob/be81252ed1f5e5fc6d77faca0b5dbbbdae8143a2/stl/inc/type_traits#L398
>  unless this was intentional and just not documented?

I have absolutely no idea what's going on here or why MSVC doesn't reject this 
usage. I've filed https://github.com/microsoft/STL/issues/4596 to track 
investigating and (most likely) removal.

https://github.com/llvm/llvm-project/pull/87725
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Add `intrin0.h` header to mimic `intrin0.h` used by MSVC STL for clang-cl (PR #75711)

2024-03-04 Thread Casey Carter via cfe-commits

https://github.com/CaseyCarter approved this pull request.

Thanks for devising this clever way to improve MSVCSTL throughput!

https://github.com/llvm/llvm-project/pull/75711
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix typo "x84_64" (PR #68419)

2023-10-06 Thread Casey Carter via cfe-commits

https://github.com/CaseyCarter closed 
https://github.com/llvm/llvm-project/pull/68419
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix typo "x84_64" (PR #68419)

2023-10-06 Thread Casey Carter via cfe-commits

CaseyCarter wrote:

The test failure _cannot possibly_ be related to this nearly non-functional 
change. Shall I merge anyway, or rerun?
```
 TEST 'BOLT :: RISCV/reloc-tls.s' FAILED 

  | Exit Code: 1
  |  
  | Command Output (stderr):
  | --
  | RUN: at line 1: 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/build/bin/llvm-mc
 -triple riscv64 -filetype obj -o 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/build/tools/bolt/test/RISCV/Output/reloc-tls.s.tmp.o
 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/bolt/test/RISCV/reloc-tls.s
  | + 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/build/bin/llvm-mc
 -triple riscv64 -filetype obj -o 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/build/tools/bolt/test/RISCV/Output/reloc-tls.s.tmp.o
 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/bolt/test/RISCV/reloc-tls.s
  | RUN: at line 2: 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/build/bin/ld.lld
 --emit-relocs -o 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/build/tools/bolt/test/RISCV/Output/reloc-tls.s.tmp
 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/build/tools/bolt/test/RISCV/Output/reloc-tls.s.tmp.o
  | + 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/build/bin/ld.lld
 --emit-relocs -o 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/build/tools/bolt/test/RISCV/Output/reloc-tls.s.tmp
 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/build/tools/bolt/test/RISCV/Output/reloc-tls.s.tmp.o
  | RUN: at line 3: 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/build/bin/llvm-bolt
 --print-cfg --print-only=tls_le,tls_ie -o /dev/null 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/build/tools/bolt/test/RISCV/Output/reloc-tls.s.tmp
 \| 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/build/bin/FileCheck
 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/bolt/test/RISCV/reloc-tls.s
  | + 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/build/bin/FileCheck
 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/bolt/test/RISCV/reloc-tls.s
  | + 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/build/bin/llvm-bolt
 --print-cfg --print-only=tls_le,tls_ie -o /dev/null 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/build/tools/bolt/test/RISCV/Output/reloc-tls.s.tmp
  | 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/bolt/test/RISCV/reloc-tls.s:14:11:
 error: CHECK: expected string not found in input
  | // CHECK: auipc a0, %pcrel_hi(__BOLT_got_zero+{{[0-9]+}})
  | ^
  | :63:70: note: scanning from here
  | 0004: auipc a0, %pcrel_hi(__BOLT_got_zero+74232) # Label: .Ltmp0
  | ^
  | :64:9: note: possible intended match here
  | 0008: ld a0, %pcrel_lo(.Ltmp0)(a0)
  | ^
  |  
  | Input file: 
  | Check file: 
/var/lib/buildkite-agent/builds/linux-56-7f758798dd-khkmx-1/llvm-project/github-pull-requests/bolt/test/RISCV/reloc-tls.s
  |  
  | -dump-input=help explains the following input dump.
  |  
  | Input was:
  | <<
  | .
  | .
  | .
  | 58: }
  | 59: .LBB01 (4 instructions, align : 1)
  | 60:  Entry Point
  | 61:  CFI State : 0
  | 62:  : addi zero, zero, 0 # Size: 4 # NOP: 1
  | 63:  0004: auipc a0, %pcrel_hi(__BOLT_got_zero+74232) # Label: .Ltmp0
  | check:14'0  
X error: no match found
  | 64:  0008: ld a0, %pcrel_lo(.Ltmp0)(a0)
  | check:14'0 
  | check:14'1 ?possible intended 
match
  | 65:  000c: jalr zero, 0(ra)
  | check:14'0 
  | 66:  CFI State: 0
  | check:14'0 ~~
  | 67:
  | check:14'0 ~
  | 68: DWARF CFI Instructions:
  | check:14'0 
  | 69:  
  | check:14'0 ~
  | .
  | .
  | .
  | >>
```


https://github.com/llvm/llvm-project/pull/68419
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix typo "x84_64" (PR #68419)

2023-10-06 Thread Casey Carter via cfe-commits

https://github.com/CaseyCarter created 
https://github.com/llvm/llvm-project/pull/68419

Apparently great minds think alike: I noticed these while correcting the same 
typo in MSVC's sources.

>From 2c4ce58cb944774bcfc404ebbeed167c320fbb28 Mon Sep 17 00:00:00 2001
From: Casey Carter 
Date: Fri, 6 Oct 2023 07:00:21 -0700
Subject: [PATCH] Fix typo "x84_64"

---
 clang/test/Driver/cuda-detect.cu   | 2 +-
 llvm/lib/Target/X86/X86RegisterInfo.td | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/test/Driver/cuda-detect.cu b/clang/test/Driver/cuda-detect.cu
index ad6b90c90c7b756..077d555a3128f27 100644
--- a/clang/test/Driver/cuda-detect.cu
+++ b/clang/test/Driver/cuda-detect.cu
@@ -29,7 +29,7 @@
 // RUN:   --sysroot=%S/Inputs/CUDA-nolibdevice --cuda-path-ignore-env 2>&1 | 
FileCheck %s -check-prefix NOCUDA
 // RUN: %clang -v --target=x86_64-unknown-linux \
 // RUN:   --sysroot=%S/Inputs/CUDA-nolibdevice --cuda-path-ignore-env 2>&1 | 
FileCheck %s -check-prefix NOCUDA
-// RUN: %clang -v --target=x84_64-apple-macosx \
+// RUN: %clang -v --target=x86_64-apple-macosx \
 // RUN:   --sysroot=%S/Inputs/CUDA-nolibdevice --cuda-path-ignore-env 2>&1 | 
FileCheck %s -check-prefix NOCUDA
 
 // ... unless the user doesn't need libdevice
diff --git a/llvm/lib/Target/X86/X86RegisterInfo.td 
b/llvm/lib/Target/X86/X86RegisterInfo.td
index 1e6477e658b9d10..81b7597cc8ea5c0 100644
--- a/llvm/lib/Target/X86/X86RegisterInfo.td
+++ b/llvm/lib/Target/X86/X86RegisterInfo.td
@@ -508,7 +508,7 @@ def GR64_NOREX_NOSP : RegisterClass<"X86", [i64], 64,
 (and GR64_NOREX, GR64_NOSP)>;
 
 // Register classes used for ABIs that use 32-bit address accesses,
-// while using the whole x84_64 ISA.
+// while using the whole x86_64 ISA.
 
 // In such cases, it is fine to use RIP as we are sure the 32 high
 // bits are not set. We do not need variants for NOSP as RIP is not

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 68b30bc - [NFC] Correct spelling of "ambiguous"

2020-04-28 Thread Casey Carter via cfe-commits

Author: Casey Carter
Date: 2020-04-28T14:51:37-07:00
New Revision: 68b30bc02b3a7e84d03f43a82cc08e5df76a28dd

URL: 
https://github.com/llvm/llvm-project/commit/68b30bc02b3a7e84d03f43a82cc08e5df76a28dd
DIFF: 
https://github.com/llvm/llvm-project/commit/68b30bc02b3a7e84d03f43a82cc08e5df76a28dd.diff

LOG: [NFC] Correct spelling of "ambiguous"

Added: 


Modified: 
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaOverload.cpp

libcxx/test/std/utilities/optional/optional.object/optional.object.assign/const_optional_U.pass.cpp

libcxx/test/std/utilities/optional/optional.object/optional.object.assign/optional_U.pass.cpp
llvm/lib/CodeGen/ReachingDefAnalysis.cpp

Removed: 




diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 8a0dd4a1d96f..c3c5533b73ec 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -6862,7 +6862,7 @@ class Sema final {
 bool IgnoreAccess = false);
   bool CheckDerivedToBaseConversion(QualType Derived, QualType Base,
 unsigned InaccessibleBaseID,
-unsigned AmbigiousBaseConvID,
+unsigned AmbiguousBaseConvID,
 SourceLocation Loc, SourceRange Range,
 DeclarationName Name,
 CXXCastPath *BasePath,

diff  --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index e827fe3b1ace..78d9322bf393 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -2821,13 +2821,13 @@ void Sema::BuildBasePathArray(const CXXBasePaths ,
 /// if there is an error, and Range is the source range to highlight
 /// if there is an error.
 ///
-/// If either InaccessibleBaseID or AmbigiousBaseConvID are 0, then the
+/// If either InaccessibleBaseID or AmbiguousBaseConvID are 0, then the
 /// diagnostic for the respective type of error will be suppressed, but the
 /// check for ill-formed code will still be performed.
 bool
 Sema::CheckDerivedToBaseConversion(QualType Derived, QualType Base,
unsigned InaccessibleBaseID,
-   unsigned AmbigiousBaseConvID,
+   unsigned AmbiguousBaseConvID,
SourceLocation Loc, SourceRange Range,
DeclarationName Name,
CXXCastPath *BasePath,
@@ -2853,7 +2853,7 @@ Sema::CheckDerivedToBaseConversion(QualType Derived, 
QualType Base,
 for (const CXXBasePath  : Paths) {
   if (PossiblePath.size() == 1) {
 Path = 
-if (AmbigiousBaseConvID)
+if (AmbiguousBaseConvID)
   Diag(Loc, diag::ext_ms_ambiguous_direct_base)
   << Base << Derived << Range;
 break;
@@ -2881,7 +2881,7 @@ Sema::CheckDerivedToBaseConversion(QualType Derived, 
QualType Base,
 return false;
   }
 
-  if (AmbigiousBaseConvID) {
+  if (AmbiguousBaseConvID) {
 // We know that the derived-to-base conversion is ambiguous, and
 // we're going to produce a diagnostic. Perform the derived-to-base
 // search just one more time to compute all of the possible paths so
@@ -2900,7 +2900,7 @@ Sema::CheckDerivedToBaseConversion(QualType Derived, 
QualType Base,
 // to each base class subobject.
 std::string PathDisplayStr = getAmbiguousPathsDisplayString(Paths);
 
-Diag(Loc, AmbigiousBaseConvID)
+Diag(Loc, AmbiguousBaseConvID)
 << Derived << Base << PathDisplayStr << Range << Name;
   }
   return true;

diff  --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 1db854e789d7..fb5eff006fd3 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -3003,13 +3003,13 @@ bool Sema::CheckPointerConversion(Expr *From, QualType 
ToType,
 // We must have a derived-to-base conversion. Check an
 // ambiguous or inaccessible conversion.
 unsigned InaccessibleID = 0;
-unsigned AmbigiousID = 0;
+unsigned AmbiguousID = 0;
 if (Diagnose) {
   InaccessibleID = diag::err_upcast_to_inaccessible_base;
-  AmbigiousID = diag::err_ambiguous_derived_to_base_conv;
+  AmbiguousID = diag::err_ambiguous_derived_to_base_conv;
 }
 if (CheckDerivedToBaseConversion(
-FromPointeeType, ToPointeeType, InaccessibleID, AmbigiousID,
+FromPointeeType, ToPointeeType, InaccessibleID, AmbiguousID,
 From->getExprLoc(), From->getSourceRange(), DeclarationName(),
 , IgnoreBaseAccess))
   return true;

diff  --git 

[libcxx] r336618 - [test] two small cleanups:

2018-07-09 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Mon Jul  9 16:45:09 2018
New Revision: 336618

URL: http://llvm.org/viewvc/llvm-project?rev=336618=rev
Log:
[test] two small cleanups:

* Remove unused type from is_assignable.pass.cpp

* Don't specialize `common_type<::X>` in common_type.pass.cpp, which 
violates the requirements of [meta.trans.other]/5

Modified:

libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp

libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp?rev=336618=336617=336618=diff
==
--- 
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
 Mon Jul  9 16:45:09 2018
@@ -11,8 +11,9 @@
 
 // common_type
 
-#include 
+#include 
 #include 
+#include 
 
 #include "test_macros.h"
 
@@ -45,7 +46,6 @@ namespace std
 
 template <> struct common_type< ::S, long> {};
 template <> struct common_type > {};
-template <> struct common_type< ::X > {};
 template <> struct common_type< ::X, ::X > {};
 }
 
@@ -97,7 +97,6 @@ void test_bullet_two() {
   static_assert(std::is_same, int 
volatile*>::value, "");
   static_assert(std::is_same, void(*)()>::value, "");
 
-  static_assert(no_common_type >::value, "");
   static_assert(no_common_type >::value, "");
 }
 

Modified: 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp?rev=336618=336617=336618=diff
==
--- 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp
 Mon Jul  9 16:45:09 2018
@@ -59,8 +59,6 @@ struct E
 template 
 struct X { T t; };
 
-struct Incomplete;
-
 int main()
 {
 test_is_assignable ();


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r336502 - type_traits: aligned_union is NOT the same as __uncvref [NFC]

2018-07-07 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Sat Jul  7 17:06:27 2018
New Revision: 336502

URL: http://llvm.org/viewvc/llvm-project?rev=336502=rev
Log:
type_traits: aligned_union is NOT the same as __uncvref [NFC]

Modified:
libcxx/trunk/include/type_traits

Modified: libcxx/trunk/include/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=336502=336501=336502=diff
==
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Sat Jul  7 17:06:27 2018
@@ -21,7 +21,7 @@ namespace std
 template  struct integral_constant;
 typedef integral_constant  true_type;   // C++11
 typedef integral_constant false_type;  // C++11
-
+
 template// C++14
 using bool_constant = integral_constant;   // C++14
 typedef bool_constant true_type;  // C++14
@@ -172,7 +172,7 @@ namespace std
   using add_volatile_t= typename add_volatile::type;  // C++14
 template 
   using add_cv_t  = typename add_cv::type;  // C++14
-  
+
 // reference modifications:
 template 
   using remove_reference_t = typename remove_reference::type;  // 
C++14
@@ -180,13 +180,13 @@ namespace std
   using add_lvalue_reference_t = typename add_lvalue_reference::type;  
// C++14
 template 
   using add_rvalue_reference_t = typename add_rvalue_reference::type;  
// C++14
-  
+
 // sign modifications:
 template 
   using make_signed_t   = typename make_signed::type;  // C++14
 template 
   using make_unsigned_t = typename make_unsigned::type;  // C++14
-  
+
 // array modifications:
 template 
   using remove_extent_t  = typename remove_extent::type;  // C++14
@@ -223,7 +223,7 @@ namespace std
 
 template 
   using void_t = void;   // C++17
-  
+
   // See C++14 20.10.4.1, primary type categories
   template  inline constexpr bool is_void_v
 = is_void::value; // 
C++17
@@ -386,13 +386,13 @@ namespace std
 
   // [meta.logical], logical operator traits:
   template struct conjunction;   // 
C++17
-  template 
+  template
 inline constexpr bool conjunction_v = conjunction::value;  // 
C++17
   template struct disjunction;   // 
C++17
   template
 inline constexpr bool disjunction_v = disjunction::value;  // 
C++17
   template struct negation; // 
C++17
-  template 
+  template
 inline constexpr bool negation_v = negation::value;   // 
C++17
 
 }
@@ -595,7 +595,7 @@ template
 struct __and_<_B0, _B1> : conditional<_B0::value, _B1, _B0>::type {};
 
 template
-struct __and_<_B0, _B1, _B2, _Bn...> 
+struct __and_<_B0, _B1, _B2, _Bn...>
 : conditional<_B0::value, __and_<_B1, _B2, _Bn...>, _B0>::type {};
 
 // __or_
@@ -608,11 +608,11 @@ template
 struct __or_<_B0, _B1> : conditional<_B0::value, _B0, _B1>::type {};
 
 template
-struct __or_<_B0, _B1, _B2, _Bn...> 
+struct __or_<_B0, _B1, _B2, _Bn...>
 : conditional<_B0::value, _B0, __or_<_B1, _B2, _Bn...> >::type {};
 
 // __not_
-template 
+template
 struct __not_ : conditional<_Tp::value, false_type, true_type>::type {};
 
 #endif // !defined(_LIBCPP_CXX03_LANG)
@@ -903,7 +903,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 
 // template  struct__libcpp_is_member_function_pointer  
   : public false_type {};
 // template  struct 
__libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {};
-// 
+//
 
 template 
 struct __member_pointer_traits_imp
@@ -1184,7 +1184,7 @@ struct __is_same_uncvref : is_same::type> {};
 
 #if _LIBCPP_STD_VER > 17
-// aligned_union - same as __uncvref
+// remove_cvref - same as __uncvref
 template 
 struct remove_cvref : public __uncvref<_Tp> {};
 
@@ -1211,12 +1211,12 @@ template  using remove_pointe
 
 // add_pointer
 
-template ::value || 
+template ::value ||
 is_same::type, void>::value>
 struct __add_pointer_impl
 {typedef typename remove_reference<_Tp>::type* type;};
-template  struct __add_pointer_impl<_Tp, false> 
+template  struct __add_pointer_impl<_Tp, false>
 {typedef _Tp type;};
 
 template  struct _LIBCPP_TEMPLATE_VIS add_pointer
@@ -1630,7 +1630,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 #if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS)
 
 template  struct _LIBCPP_TEMPLATE_VIS 
has_unique_object_representations
-: public integral_constant>)> {};
 
 #if !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
@@ -2241,7 +2241,7 @@ struct __is_destructor_wellformed {
 
 template 
 static __two __test (...);
-
+
 static const bool value = sizeof(__test<_Tp>(12)) == sizeof(char);
 };
 
@@ -2249,8 +2249,8 @@ template 
 struct __destructible_imp;
 
 template 
-struct 

[libcxx] r329618 - [test] [NFC] cleanup aligned_storage test

2018-04-09 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Mon Apr  9 13:41:45 2018
New Revision: 329618

URL: http://llvm.org/viewvc/llvm-project?rev=329618=rev
Log:
[test] [NFC] cleanup aligned_storage test

* `s/"" )/"")/g`
* Don't redundantly test triviality for `TEST_STD_VER > 17`

Modified:

libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp?rev=329618=329617=329618=diff
==
--- 
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
 Mon Apr  9 13:41:45 2018
@@ -23,13 +23,10 @@ int main()
 {
 typedef std::aligned_storage<10, 1 >::type T1;
 #if TEST_STD_VER > 11
-static_assert(std::is_same, T1>::value, "" );
+static_assert(std::is_same, T1>::value, "");
 #endif
-#if TEST_STD_VER > 17
-//  P0767
-static_assert(std::is_trivial::value, "" );
-#else
-static_assert(std::is_pod::value, "" );
+#if TEST_STD_VER <= 17
+static_assert(std::is_pod::value, "");
 #endif
 static_assert(std::is_trivial::value, "");
 static_assert(std::is_standard_layout::value, "");
@@ -39,13 +36,10 @@ int main()
 {
 typedef std::aligned_storage<10, 2 >::type T1;
 #if TEST_STD_VER > 11
-static_assert(std::is_same, T1>::value, "" );
+static_assert(std::is_same, T1>::value, "");
 #endif
-#if TEST_STD_VER > 17
-//  P0767
-static_assert(std::is_trivial::value, "" );
-#else
-static_assert(std::is_pod::value, "" );
+#if TEST_STD_VER <= 17
+static_assert(std::is_pod::value, "");
 #endif
 static_assert(std::is_trivial::value, "");
 static_assert(std::is_standard_layout::value, "");
@@ -55,13 +49,10 @@ int main()
 {
 typedef std::aligned_storage<10, 4 >::type T1;
 #if TEST_STD_VER > 11
-static_assert(std::is_same, T1>::value, "" );
+static_assert(std::is_same, T1>::value, "");
 #endif
-#if TEST_STD_VER > 17
-//  P0767
-static_assert(std::is_trivial::value, "" );
-#else
-static_assert(std::is_pod::value, "" );
+#if TEST_STD_VER <= 17
+static_assert(std::is_pod::value, "");
 #endif
 static_assert(std::is_trivial::value, "");
 static_assert(std::is_standard_layout::value, "");
@@ -71,13 +62,10 @@ int main()
 {
 typedef std::aligned_storage<10, 8 >::type T1;
 #if TEST_STD_VER > 11
-static_assert(std::is_same, T1>::value, "" );
+static_assert(std::is_same, T1>::value, "");
 #endif
-#if TEST_STD_VER > 17
-//  P0767
-static_assert(std::is_trivial::value, "" );
-#else
-static_assert(std::is_pod::value, "" );
+#if TEST_STD_VER <= 17
+static_assert(std::is_pod::value, "");
 #endif
 static_assert(std::is_trivial::value, "");
 static_assert(std::is_standard_layout::value, "");
@@ -87,13 +75,10 @@ int main()
 {
 typedef std::aligned_storage<10, 16 >::type T1;
 #if TEST_STD_VER > 11
-static_assert(std::is_same, T1>::value, "" 
);
+static_assert(std::is_same, T1>::value, "");
 #endif
-#if TEST_STD_VER > 17
-//  P0767
-static_assert(std::is_trivial::value, "" );
-#else
-static_assert(std::is_pod::value, "" );
+#if TEST_STD_VER <= 17
+static_assert(std::is_pod::value, "");
 #endif
 static_assert(std::is_trivial::value, "");
 static_assert(std::is_standard_layout::value, "");
@@ -103,13 +88,10 @@ int main()
 {
 typedef std::aligned_storage<10, 32 >::type T1;
 #if TEST_STD_VER > 11
-static_assert(std::is_same, T1>::value, "" 
);
+static_assert(std::is_same, T1>::value, "");
 #endif
-#if TEST_STD_VER > 17
-//  P0767
-static_assert(std::is_trivial::value, "" );
-#else
-static_assert(std::is_pod::value, "" );
+#if TEST_STD_VER <= 17
+static_assert(std::is_pod::value, "");
 #endif
 static_assert(std::is_trivial::value, "");
 static_assert(std::is_standard_layout::value, "");
@@ -119,13 +101,10 @@ int main()
 {
 typedef std::aligned_storage<20, 32 >::type T1;
 #if TEST_STD_VER > 11
-static_assert(std::is_same, T1>::value, "" 
);
+static_assert(std::is_same, T1>::value, "");
 #endif
-#if TEST_STD_VER > 17
-//  P0767
-static_assert(std::is_trivial::value, "" );
-#else
-static_assert(std::is_pod::value, "" );
+#if TEST_STD_VER <= 17
+

[libcxx] r320500 - workaround PR 28385 in __find_exactly_one_checked

2017-12-12 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Tue Dec 12 09:22:24 2017
New Revision: 320500

URL: http://llvm.org/viewvc/llvm-project?rev=320500=rev
Log:
workaround PR 28385 in __find_exactly_one_checked

Fixes #35578.

Differential Revision: D41048

Modified:
libcxx/trunk/include/tuple

Modified: libcxx/trunk/include/tuple
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/tuple?rev=320500=320499=320500=diff
==
--- libcxx/trunk/include/tuple (original)
+++ libcxx/trunk/include/tuple Tue Dec 12 09:22:24 2017
@@ -1012,10 +1012,10 @@ constexpr size_t __find_idx(size_t __i,
 
 template 
 struct __find_exactly_one_checked {
-  static constexpr bool __matches[] = {is_same<_T1, _Args>::value...};
+static constexpr bool __matches[sizeof...(_Args)] = {is_same<_T1, 
_Args>::value...};
 static constexpr size_t value = __find_detail::__find_idx(0, __matches);
-static_assert (value != __not_found, "type not found in type list" );
-static_assert(value != __ambiguous,"type occurs more than once in type 
list");
+static_assert(value != __not_found, "type not found in type list" );
+static_assert(value != __ambiguous, "type occurs more than once in type 
list");
 };
 
 template 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r318325 - [test] Alignment must be > __STDCPP_DEFAULT_NEW_ALIGNMENT__ to call aligned new

2017-11-15 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Wed Nov 15 11:14:45 2017
New Revision: 318325

URL: http://llvm.org/viewvc/llvm-project?rev=318325=rev
Log:
[test] Alignment must be > __STDCPP_DEFAULT_NEW_ALIGNMENT__ to call aligned new

Differential Revision: D39221

Modified:

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp

Modified: 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp?rev=318325=318324=318325=diff
==
--- 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
 Wed Nov 15 11:14:45 2017
@@ -36,7 +36,7 @@
 
 #include "test_macros.h"
 
-constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2;
 
 int unsized_delete_called = 0;
 int unsized_delete_nothrow_called = 0;

Modified: 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp?rev=318325=318324=318325=diff
==
--- 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
 Wed Nov 15 11:14:45 2017
@@ -38,7 +38,7 @@
 
 #include "test_macros.h"
 
-constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2;
 
 int new_handler_called = 0;
 

Modified: 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp?rev=318325=318324=318325=diff
==
--- 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
 Wed Nov 15 11:14:45 2017
@@ -37,7 +37,7 @@
 
 #include "test_macros.h"
 
-constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2;
 
 int new_handler_called = 0;
 

Modified: 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp?rev=318325=318324=318325=diff
==
--- 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
 Wed Nov 15 11:14:45 2017
@@ -34,7 +34,7 @@
 
 #include "test_macros.h"
 
-constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+constexpr auto OverAligned = 

[libcxx] r314608 - [test] Allow other implementations to strengthen noexcept on deque's move constructor

2017-09-30 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Sat Sep 30 16:15:22 2017
New Revision: 314608

URL: http://llvm.org/viewvc/llvm-project?rev=314608=rev
Log:
[test] Allow other implementations to strengthen noexcept on deque's move 
constructor

Modified:

libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp

Modified: 
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp?rev=314608=314607=314608=diff
==
--- 
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
 Sat Sep 30 16:15:22 2017
@@ -45,9 +45,9 @@ int main()
 typedef std::deque C;
 static_assert(std::is_nothrow_move_constructible::value, "");
 }
-#endif // _LIBCPP_VERSION
 {
 typedef std::deque C;
 static_assert(!std::is_nothrow_move_constructible::value, "");
 }
+#endif // _LIBCPP_VERSION
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r314459 - [test] forwardlist.cons/move_noexcept.pass.cpp

2017-09-28 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Thu Sep 28 13:23:43 2017
New Revision: 314459

URL: http://llvm.org/viewvc/llvm-project?rev=314459=rev
Log:
[test] forwardlist.cons/move_noexcept.pass.cpp

* Don't forbid non-libc++ implementations from strengthening noexcept on 
forward_list's move constructor.

Modified:

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp

Modified: 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp?rev=314459=314458=314459=diff
==
--- 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp
 Thu Sep 28 13:23:43 2017
@@ -45,9 +45,9 @@ int main()
 typedef std::forward_list C;
 static_assert(std::is_nothrow_move_constructible::value, "");
 }
-#endif // _LIBCPP_VERSION
 {
 typedef std::forward_list C;
 static_assert(!std::is_nothrow_move_constructible::value, "");
 }
+#endif // _LIBCPP_VERSION
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r312256 - [test] Cleanup nullopt_t tests

2017-08-31 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Thu Aug 31 10:56:31 2017
New Revision: 312256

URL: http://llvm.org/viewvc/llvm-project?rev=312256=rev
Log:
[test] Cleanup nullopt_t tests

* Update specification text from N4387

* Delete not_brace_initializable.fail.cpp: it's redundant with 
nullopt_t.fail.cpp

* is_empty implies is_class

* is_literal is deprecated; directly verify that we can create a nullopt_t in a 
constexpr context

Differential Revision: D37024

Removed:

libcxx/trunk/test/std/utilities/optional/optional.nullopt/not_brace_initializable.fail.cpp
Modified:
libcxx/trunk/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp
libcxx/trunk/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp

Removed: 
libcxx/trunk/test/std/utilities/optional/optional.nullopt/not_brace_initializable.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.nullopt/not_brace_initializable.fail.cpp?rev=312255=auto
==
--- 
libcxx/trunk/test/std/utilities/optional/optional.nullopt/not_brace_initializable.fail.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/optional/optional.nullopt/not_brace_initializable.fail.cpp
 (removed)
@@ -1,25 +0,0 @@
-//===--===//
-//
-// The 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: c++98, c++03, c++11, c++14
-// 
-
-// struct nullopt_t{see below};
-
-#include 
-
-using std::optional;
-using std::nullopt_t;
-
-int main()
-{
-// I roughly interpret LWG2736 as "it shall not be possible to 
copy-list-initialize nullopt_t with an
-// empty braced-init-list."
-nullopt_t foo = {};
-}

Modified: 
libcxx/trunk/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp?rev=312256=312255=312256=diff
==
--- 
libcxx/trunk/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp 
(original)
+++ 
libcxx/trunk/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp 
Thu Aug 31 10:56:31 2017
@@ -11,15 +11,13 @@
 // 
 
 // struct nullopt_t{see below};
-// constexpr nullopt_t nullopt(unspecified);
+// inline constexpr nullopt_t nullopt(unspecified);
 
 // [optional.nullopt]/2:
-//   Type nullopt_t shall not have a default constructor or an 
initializer-list constructor.
-//   It shall not be an aggregate and shall be a literal type.
-//   Constant nullopt shall be initialized with an argument of literal type.
+//   Type nullopt_t shall not have a default constructor or an initializer-list
+//   constructor, and shall not be an aggregate.
 
 #include 
-#include "test_macros.h"
 
 int main()
 {

Modified: 
libcxx/trunk/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp?rev=312256=312255=312256=diff
==
--- 
libcxx/trunk/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp 
Thu Aug 31 10:56:31 2017
@@ -11,33 +11,30 @@
 // 
 
 // struct nullopt_t{see below};
-// constexpr nullopt_t nullopt(unspecified);
+// inline constexpr nullopt_t nullopt(unspecified);
 
 // [optional.nullopt]/2:
-//   Type nullopt_t shall not have a default constructor or an 
initializer-list constructor.
-//   It shall not be an aggregate and shall be a literal type.
-//   Constant nullopt shall be initialized with an argument of literal type.
+//   Type nullopt_t shall not have a default constructor or an initializer-list
+//   constructor, and shall not be an aggregate.
 
 #include 
 #include 
 
-using std::optional;
 using std::nullopt_t;
 using std::nullopt;
 
-constexpr
-int
-test(const nullopt_t&)
+constexpr bool test()
 {
-return 3;
+nullopt_t foo{nullopt};
+(void)foo;
+return true;
 }
 
 int main()
 {
-static_assert(( std::is_class::value), "");
-static_assert(( std::is_empty::value), "");
-static_assert(( std::is_literal_type::value), "");
-static_assert((!std::is_default_constructible::value), "");
+static_assert(std::is_empty_v);
+static_assert(!std::is_default_constructible_v);
 
-static_assert(test(nullopt) == 3, "");
+static_assert(std::is_same_v);
+static_assert(test());
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org

[libcxx] r307505 - optional: Implement LWG 2900 and P0602

2017-07-09 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Sun Jul  9 10:15:49 2017
New Revision: 307505

URL: http://llvm.org/viewvc/llvm-project?rev=307505=rev
Log:
optional: Implement LWG 2900 and P0602

Differential Revision: https://reviews.llvm.org/D32385

Removed:

libcxx/trunk/test/libcxx/utilities/optional/optional.object/special_member_gen.pass.cpp
Modified:
libcxx/trunk/include/optional

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/move.pass.cpp

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp

libcxx/trunk/test/std/utilities/optional/optional.object/special_member_gen.pass.cpp

Modified: libcxx/trunk/include/optional
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/optional?rev=307505=307504=307505=diff
==
--- libcxx/trunk/include/optional (original)
+++ libcxx/trunk/include/optional Sun Jul  9 10:15:49 2017
@@ -439,46 +439,122 @@ struct __optional_storage_base<_Tp, true
 }
 };
 
-template ::value>
-struct __optional_storage;
-
-template 
-struct __optional_storage<_Tp, true> : __optional_storage_base<_Tp>
+template ::value>
+struct __optional_copy_base : __optional_storage_base<_Tp>
 {
 using __optional_storage_base<_Tp>::__optional_storage_base;
 };
 
 template 
-struct __optional_storage<_Tp, false> : __optional_storage_base<_Tp>
+struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp>
 {
-using value_type = _Tp;
 using __optional_storage_base<_Tp>::__optional_storage_base;
 
 _LIBCPP_INLINE_VISIBILITY
-__optional_storage() = default;
+__optional_copy_base() = default;
 
 _LIBCPP_INLINE_VISIBILITY
-__optional_storage(const __optional_storage& __opt)
+__optional_copy_base(const __optional_copy_base& __opt)
 {
 this->__construct_from(__opt);
 }
 
 _LIBCPP_INLINE_VISIBILITY
-__optional_storage(__optional_storage&& __opt)
+__optional_copy_base(__optional_copy_base&&) = default;
+_LIBCPP_INLINE_VISIBILITY
+__optional_copy_base& operator=(const __optional_copy_base&) = default;
+_LIBCPP_INLINE_VISIBILITY
+__optional_copy_base& operator=(__optional_copy_base&&) = default;
+};
+
+template ::value>
+struct __optional_move_base : __optional_copy_base<_Tp>
+{
+using __optional_copy_base<_Tp>::__optional_copy_base;
+};
+
+template 
+struct __optional_move_base<_Tp, false> : __optional_copy_base<_Tp>
+{
+using value_type = _Tp;
+using __optional_copy_base<_Tp>::__optional_copy_base;
+
+_LIBCPP_INLINE_VISIBILITY
+__optional_move_base() = default;
+_LIBCPP_INLINE_VISIBILITY
+__optional_move_base(const __optional_move_base&) = default;
+
+_LIBCPP_INLINE_VISIBILITY
+__optional_move_base(__optional_move_base&& __opt)
 noexcept(is_nothrow_move_constructible_v)
 {
 this->__construct_from(_VSTD::move(__opt));
 }
 
 _LIBCPP_INLINE_VISIBILITY
-__optional_storage& operator=(const __optional_storage& __opt)
+__optional_move_base& operator=(const __optional_move_base&) = default;
+_LIBCPP_INLINE_VISIBILITY
+__optional_move_base& operator=(__optional_move_base&&) = default;
+};
+
+template ::value &&
+is_trivially_copy_constructible<_Tp>::value &&
+is_trivially_copy_assignable<_Tp>::value>
+struct __optional_copy_assign_base : __optional_move_base<_Tp>
+{
+using __optional_move_base<_Tp>::__optional_move_base;
+};
+
+template 
+struct __optional_copy_assign_base<_Tp, false> : __optional_move_base<_Tp>
+{
+using __optional_move_base<_Tp>::__optional_move_base;
+
+_LIBCPP_INLINE_VISIBILITY
+__optional_copy_assign_base() = default;
+_LIBCPP_INLINE_VISIBILITY
+__optional_copy_assign_base(const __optional_copy_assign_base&) = default;
+_LIBCPP_INLINE_VISIBILITY
+__optional_copy_assign_base(__optional_copy_assign_base&&) = default;
+
+_LIBCPP_INLINE_VISIBILITY
+__optional_copy_assign_base& operator=(const __optional_copy_assign_base& 
__opt)
 {
 this->__assign_from(__opt);
 return *this;
 }
 
 _LIBCPP_INLINE_VISIBILITY
-__optional_storage& operator=(__optional_storage&& __opt)
+__optional_copy_assign_base& operator=(__optional_copy_assign_base&&) = 
default;
+};
+
+template ::value &&
+is_trivially_move_constructible<_Tp>::value &&
+is_trivially_move_assignable<_Tp>::value>
+struct __optional_move_assign_base : __optional_copy_assign_base<_Tp>
+{
+using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
+};
+
+template 
+struct __optional_move_assign_base<_Tp, false> : 
__optional_copy_assign_base<_Tp>
+{
+using value_type = _Tp;
+using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
+
+_LIBCPP_INLINE_VISIBILITY
+__optional_move_assign_base() = default;
+

[libcxx] r304847 - [test] Test changes to accommodate LWG 2904 "Make variant move-assignment more exception safe"

2017-06-06 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Tue Jun  6 19:06:04 2017
New Revision: 304847

URL: http://llvm.org/viewvc/llvm-project?rev=304847=rev
Log:
[test] Test changes to accommodate LWG 2904 "Make variant move-assignment more 
exception safe"

Also: Move constexpr / triviality extension tests into the std tree and make 
them conditional on _LIBCPP_VERSION / _MSVC_STL_VERSION.

https://reviews.llvm.org/D32671

Removed:

libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp

libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp

libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp

libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
Modified:

libcxx/trunk/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp

libcxx/trunk/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp

libcxx/trunk/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp

libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp

libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
libcxx/trunk/test/support/variant_test_helpers.hpp

Removed: 
libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp?rev=304846=auto
==
--- 
libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
 (original)
+++ 
libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
 (removed)
@@ -1,209 +0,0 @@
-// -*- 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.
-//
-//===--===//
-
-// UNSUPPORTED: c++98, c++03, c++11, c++14
-
-// The following compilers don't generate constexpr special members correctly.
-// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8
-// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0
-
-// 
-
-// template  class variant;
-
-// variant& operator=(variant const&);
-
-#include 
-#include 
-
-#include "test_macros.h"
-
-struct NTCopyAssign {
-  constexpr NTCopyAssign(int v) : value(v) {}
-  NTCopyAssign(const NTCopyAssign &) = default;
-  NTCopyAssign(NTCopyAssign &&) = default;
-  NTCopyAssign =(const NTCopyAssign ) {
-value = that.value;
-return *this;
-  };
-  NTCopyAssign =(NTCopyAssign &&) = delete;
-  int value;
-};
-
-static_assert(!std::is_trivially_copy_assignable::value, "");
-static_assert(std::is_copy_assignable::value, "");
-
-struct TCopyAssign {
-  constexpr TCopyAssign(int v) : value(v) {}
-  TCopyAssign(const TCopyAssign &) = default;
-  TCopyAssign(TCopyAssign &&) = default;
-  TCopyAssign =(const TCopyAssign &) = default;
-  TCopyAssign =(TCopyAssign &&) = delete;
-  int value;
-};
-
-static_assert(std::is_trivially_copy_assignable::value, "");
-
-struct TCopyAssignNTMoveAssign {
-  constexpr TCopyAssignNTMoveAssign(int v) : value(v) {}
-  TCopyAssignNTMoveAssign(const TCopyAssignNTMoveAssign &) = default;
-  TCopyAssignNTMoveAssign(TCopyAssignNTMoveAssign &&) = default;
-  TCopyAssignNTMoveAssign =(const TCopyAssignNTMoveAssign &) = 
default;
-  TCopyAssignNTMoveAssign =(TCopyAssignNTMoveAssign &) {
-value = that.value;
-that.value = -1;
-return *this;
-  }
-  int value;
-};
-
-static_assert(std::is_trivially_copy_assignable_v, 
"");
-
-void test_copy_assignment_sfinae() {
-  {
-using V = std::variant;
-static_assert(std::is_trivially_copy_assignable::value, "");
-  }
-  {
-using V = std::variant;
-static_assert(!std::is_trivially_copy_assignable::value, "");
-static_assert(std::is_copy_assignable::value, "");
-  }
-  {
-using V = std::variant;
-static_assert(std::is_trivially_copy_assignable::value, "");
-  }
-  {
-using V = std::variant;
-static_assert(std::is_trivially_copy_assignable::value, "");
-  }
-}
-
-template  struct Result { size_t index; T value; };
-
-void test_copy_assignment_same_index() {
-  {
-struct {
-  constexpr Result operator()() const {
-using V = std::variant;
-V v(43);
-V v2(42);
-v = v2;
-return {v.index(), std::get<0>(v)};
-  }
-} test;
-constexpr auto result = test();
-static_assert(result.index == 0, "");
-static_assert(result.value == 42, "");
-  }
-  {
-struct {
-  constexpr Result operator()() const {
-using V = 

[libcxx] r304813 - add missing constexpr to optional::value_or

2017-06-06 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Tue Jun  6 13:47:26 2017
New Revision: 304813

URL: http://llvm.org/viewvc/llvm-project?rev=304813=rev
Log:
add missing constexpr to optional::value_or

[Credit to cpplearner]

Differential Revision: https://reviews.llvm.org/D27850

Modified:
libcxx/trunk/include/optional

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp

Modified: libcxx/trunk/include/optional
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/optional?rev=304813=304812=304813=diff
==
--- libcxx/trunk/include/optional (original)
+++ libcxx/trunk/include/optional Tue Jun  6 13:47:26 2017
@@ -897,7 +897,7 @@ public:
 
 template 
 _LIBCPP_INLINE_VISIBILITY
-value_type value_or(_Up&& __v) &&
+constexpr value_type value_or(_Up&& __v) &&
 {
 static_assert(is_move_constructible_v,
   "optional::value_or: T must be move constructible");

Modified: 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp?rev=304813=304812=304813=diff
==
--- 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp
 Tue Jun  6 13:47:26 2017
@@ -10,7 +10,7 @@
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 // 
 
-// template  T optional::value_or(U&& v) &&;
+// template  constexpr T optional::value_or(U&& v) &&;
 
 #include 
 #include 
@@ -26,22 +26,22 @@ struct Y
 {
 int i_;
 
-Y(int i) : i_(i) {}
+constexpr Y(int i) : i_(i) {}
 };
 
 struct X
 {
 int i_;
 
-X(int i) : i_(i) {}
-X(X&& x) : i_(x.i_) {x.i_ = 0;}
-X(const Y& y) : i_(y.i_) {}
-X(Y&& y) : i_(y.i_+1) {}
+constexpr X(int i) : i_(i) {}
+constexpr X(X&& x) : i_(x.i_) {x.i_ = 0;}
+constexpr X(const Y& y) : i_(y.i_) {}
+constexpr X(Y&& y) : i_(y.i_+1) {}
 friend constexpr bool operator==(const X& x, const X& y)
 {return x.i_ == y.i_;}
 };
 
-int main()
+constexpr int test()
 {
 {
 optional opt(in_place, 2);
@@ -65,4 +65,10 @@ int main()
 assert(std::move(opt).value_or(Y(3)) == 4);
 assert(!opt);
 }
+return 0;
+}
+
+int main()
+{
+static_assert(test() == 0);
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r304730 - [test] Remove workaround for C1XX empty parameter pack bug

2017-06-05 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Mon Jun  5 14:59:17 2017
New Revision: 304730

URL: http://llvm.org/viewvc/llvm-project?rev=304730=rev
Log:
[test] Remove workaround for C1XX empty parameter pack bug

Was VSO#109062. This bug was filed *4 years ago*. I submitted a workaround to 
enable the scoped_allocator_adaptor tests to pass. Bug fixed a week and a half 
later. This was either a waste of my time, or I've discovered that libc++ has 
magical bugfix-inducing powers. My money's on the latter.

Removed:

libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
Modified:
libcxx/trunk/test/support/test_workarounds.h
libcxx/trunk/test/support/uses_alloc_types.hpp

Removed: 
libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp?rev=304729=auto
==
--- 
libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
 (original)
+++ 
libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
 (removed)
@@ -1,49 +0,0 @@
-//===--===//
-//
-// The 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: c++98, c++03
-
-// Verify TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION.
-
-#include 
-
-#include "test_workarounds.h"
-
-template
-struct identity {
-using type = T;
-};
-
-template struct list {};
-
-// C1XX believes this function template is not viable when LArgs is an empty
-// parameter pack.
-template 
-int f2(typename identity::type..., int i) {
-return i;
-}
-
-#ifdef TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
-// C1XX believes this function template *is* viable when LArgs is an empty
-// parameter pack. Conforming compilers believe the two overloads are
-// ambiguous when LArgs is an empty pack.
-template 
-int f2(int i) {
-return i;
-}
-#endif
-
-template 
-int f1(list, Args&&... args) {
-return f2(args...);
-}
-
-int main() {
-f1(list<>{}, 42);
-}

Modified: libcxx/trunk/test/support/test_workarounds.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_workarounds.h?rev=304730=304729=304730=diff
==
--- libcxx/trunk/test/support/test_workarounds.h (original)
+++ libcxx/trunk/test/support/test_workarounds.h Mon Jun  5 14:59:17 2017
@@ -19,7 +19,6 @@
 
 #if defined(TEST_COMPILER_C1XX)
 # define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE // VSO#117743
-# define TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION // VSO#109062
 # ifndef _MSC_EXTENSIONS
 #  define TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK // VSO#119998
 # endif

Modified: libcxx/trunk/test/support/uses_alloc_types.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/uses_alloc_types.hpp?rev=304730=304729=304730=diff
==
--- libcxx/trunk/test/support/uses_alloc_types.hpp (original)
+++ libcxx/trunk/test/support/uses_alloc_types.hpp Mon Jun  5 14:59:17 2017
@@ -257,13 +257,6 @@ private:
 return alloc;
 }
 
-#ifdef TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
-template 
-static CtorAlloc getAllocatorFromPackImp(CtorAlloc const& alloc) {
-return alloc;
-}
-#endif
-
 bool has_alloc() const { return alloc_store.get_allocator() != nullptr; }
 const CtorAlloc *get_alloc() const { return alloc_store.get_allocator(); }
 public:


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r304487 - [test] Allow non-libc++ coroutine_handle::done to strengthen noexcept

2017-06-01 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Thu Jun  1 17:40:16 2017
New Revision: 304487

URL: http://llvm.org/viewvc/llvm-project?rev=304487=rev
Log:
[test] Allow non-libc++ coroutine_handle::done to strengthen noexcept

Modified:

libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.pass.cpp

libcxx/trunk/test/std/experimental/language.support/support.coroutines/end.to.end/await_result.pass.cpp

libcxx/trunk/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp

libcxx/trunk/test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.pass.cpp

Modified: 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.pass.cpp?rev=304487=304486=304487=diff
==
--- 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.pass.cpp
 Thu Jun  1 17:40:16 2017
@@ -33,7 +33,7 @@ void do_test(coro::coroutine_handlehttp://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/end.to.end/await_result.pass.cpp?rev=304487=304486=304487=diff
==
--- 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/end.to.end/await_result.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/end.to.end/await_result.pass.cpp
 Thu Jun  1 17:40:16 2017
@@ -23,7 +23,7 @@ struct coro_t {
 }
 suspend_never initial_suspend() { return {}; }
 suspend_never final_suspend() { return {}; }
-void return_void(){}
+void return_void() {}
 static void unhandled_exception() {}
   };
 };
@@ -37,7 +37,7 @@ struct B {
 
 
 struct A {
-  ~A(){}
+  ~A() {}
   bool await_ready() { return true; }
   int await_resume() { return 42; }
   template  void await_suspend(F) {}

Modified: 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp?rev=304487=304486=304487=diff
==
--- 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp
 Thu Jun  1 17:40:16 2017
@@ -25,7 +25,7 @@ struct coro_t {
 }
 suspend_never initial_suspend() { return {}; }
 suspend_never final_suspend() { return {}; }
-void return_void(){}
+void return_void() {}
 void unhandled_exception() {}
   };
   coro_t(coroutine_handle hh) : h(hh) {}

Modified: 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.pass.cpp?rev=304487=304486=304487=diff
==
--- 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.pass.cpp
 Thu Jun  1 17:40:16 2017
@@ -68,10 +68,10 @@ private:
 
 std::vector yielded_values = {};
 int yield(int x) { yielded_values.push_back(x); return x + 1; }
-float fyield(int x) { yielded_values.push_back(x); return x + 2; }
+float fyield(int x) { yielded_values.push_back(x); return static_cast(x 
+ 2); }
 
 void Do1(func f) { yield(f()); }
-void Do2(func f) { yield(f()); }
+void Do2(func f) { yield(static_cast(f())); }
 
 int main() {
   Do1([] { return yield(43); });


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r304236 - [test] s/uexpectedly/unexpectedly/

2017-05-30 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Tue May 30 15:12:55 2017
New Revision: 304236

URL: http://llvm.org/viewvc/llvm-project?rev=304236=rev
Log:
[test] s/uexpectedly/unexpectedly/

Modified:
libcxx/trunk/test/support/test_macros.h

Modified: libcxx/trunk/test/support/test_macros.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_macros.h?rev=304236=304235=304236=diff
==
--- libcxx/trunk/test/support/test_macros.h (original)
+++ libcxx/trunk/test/support/test_macros.h Tue May 30 15:12:55 2017
@@ -195,7 +195,7 @@ struct is_same { enum {value = 1};
 
 #define ASSERT_SAME_TYPE(...) \
 static_assert((test_macros_detail::is_same<__VA_ARGS__>::value), \
- "Types differ uexpectedly")
+ "Types differ unexpectedly")
 
 #ifndef TEST_HAS_NO_EXCEPTIONS
 #define TEST_THROW(...) throw __VA_ARGS__


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r303951 - [test] Fix breakage from r303947 =(

2017-05-25 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Thu May 25 20:00:56 2017
New Revision: 303951

URL: http://llvm.org/viewvc/llvm-project?rev=303951=rev
Log:
[test] Fix breakage from r303947 =(

Modified:

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp?rev=303951=303950=303951=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
 Thu May 25 20:00:56 2017
@@ -45,6 +45,7 @@ struct Foo
 virtual ~Foo() = default;
 };
 
+#ifdef _LIBCPP_VERSION
 struct Result {};
 static Result theFunction() { return Result(); }
 static int resultDeletorCount;
@@ -54,14 +55,15 @@ static void resultDeletor(Result (*pf)()
 }
 
 void test_pointer_to_function() {
-#ifdef _LIBCPP_VER
 { // https://bugs.llvm.org/show_bug.cgi?id=27566
   std::shared_ptr x(, );
   std::shared_ptr y(theFunction, resultDeletor);
 }
 assert(resultDeletorCount == 2);
-#endif
 }
+#else // _LIBCPP_VERSION
+void test_pointer_to_function() {}
+#endif // _LIBCPP_VERSION
 
 int main()
 {


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r303947 - [test] make_shared<T()>(...) is, uh, libc++-specific

2017-05-25 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Thu May 25 19:37:33 2017
New Revision: 303947

URL: http://llvm.org/viewvc/llvm-project?rev=303947=rev
Log:
[test] make_shared(...) is, uh, libc++-specific

Modified:

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp?rev=303947=303946=303947=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
 Thu May 25 19:37:33 2017
@@ -53,6 +53,16 @@ static void resultDeletor(Result (*pf)()
   ++resultDeletorCount;
 }
 
+void test_pointer_to_function() {
+#ifdef _LIBCPP_VER
+{ // https://bugs.llvm.org/show_bug.cgi?id=27566
+  std::shared_ptr x(, );
+  std::shared_ptr y(theFunction, resultDeletor);
+}
+assert(resultDeletorCount == 2);
+#endif
+}
+
 int main()
 {
 int nc = globalMemCounter.outstanding_new;
@@ -72,11 +82,9 @@ int main()
 std::shared_ptr p2 = std::make_shared();
 assert(p2.get());
 }
-{ // https://bugs.llvm.org/show_bug.cgi?id=27566
-  std::shared_ptr x(, );
-  std::shared_ptr y(theFunction, resultDeletor);
-}
-assert(resultDeletorCount == 2);
+
+test_pointer_to_function();
+
 #if TEST_STD_VER >= 11
 nc = globalMemCounter.outstanding_new;
 {


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r303889 - [test] Remove workaround for C1XX conversion-to-nullptr bug

2017-05-25 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Thu May 25 12:42:21 2017
New Revision: 303889

URL: http://llvm.org/viewvc/llvm-project?rev=303889=rev
Log:
[test] Remove workaround for C1XX conversion-to-nullptr bug

VSO#391542 "Types can't be convertible to nullptr_t"

Also put internal bug numbers on the workarounds in test_workarounds.h for 
correlation.

Differential Revision: https://reviews.llvm.org/D33290

Removed:

libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
Modified:
libcxx/trunk/test/support/poisoned_hash_helper.hpp
libcxx/trunk/test/support/test_workarounds.h

Modified: libcxx/trunk/test/support/poisoned_hash_helper.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/poisoned_hash_helper.hpp?rev=303889=303888=303889=diff
==
--- libcxx/trunk/test/support/poisoned_hash_helper.hpp (original)
+++ libcxx/trunk/test/support/poisoned_hash_helper.hpp Thu May 25 12:42:21 2017
@@ -50,11 +50,9 @@ namespace PoisonedHashDetail {
 // specializations of hash for nullptr t and all cv-unqualified
 // arithmetic, enumeration, and pointer types.
 using LibraryHashTypes = TypeList<
-#if !defined(TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR)
 #if TEST_STD_VER > 14
   decltype(nullptr),
 #endif
-#endif
   bool,
   char,
   signed char,

Removed: 
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp?rev=303888=auto
==
--- 
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
 (original)
+++ 
libcxx/trunk/test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
 (removed)
@@ -1,29 +0,0 @@
-//===--===//
-//
-// The 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: c++98, c++03
-
-// Verify TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR.
-
-#include 
-
-#include "test_workarounds.h"
-
-struct ConvertsToNullptr {
-  using DestType = decltype(nullptr);
-  operator DestType() const { return nullptr; }
-};
-
-int main() {
-#if defined(TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR)
-  static_assert(!std::is_convertible::value, "");
-#else
-  static_assert(std::is_convertible::value, "");
-#endif
-}

Modified: libcxx/trunk/test/support/test_workarounds.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_workarounds.h?rev=303889=303888=303889=diff
==
--- libcxx/trunk/test/support/test_workarounds.h (original)
+++ libcxx/trunk/test/support/test_workarounds.h Thu May 25 12:42:21 2017
@@ -14,15 +14,14 @@
 #include "test_macros.h"
 
 #if defined(TEST_COMPILER_EDG)
-# define TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR
+# define TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR // VSO#424280
 #endif
 
 #if defined(TEST_COMPILER_C1XX)
-# define TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR
-# define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
-# define TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
+# define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE // VSO#117743
+# define TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION // VSO#109062
 # ifndef _MSC_EXTENSIONS
-#  define TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK
+#  define TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK // VSO#119998
 # endif
 #endif
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r303888 - [test] Workaround C1XX bug in uses_allocator_types.hpp

2017-05-25 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Thu May 25 12:42:17 2017
New Revision: 303888

URL: http://llvm.org/viewvc/llvm-project?rev=303888=rev
Log:
[test] Workaround C1XX bug in uses_allocator_types.hpp

VSO#109062 "Explicit template argument specification with empty template 
parameter pack expansion does not imply further empty pack expansion"

Differential Revision: https://reviews.llvm.org/D33214

Added:

libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
Modified:

libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
libcxx/trunk/test/support/test_workarounds.h
libcxx/trunk/test/support/uses_alloc_types.hpp

Modified: 
libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp?rev=303888=303887=303888=diff
==
--- 
libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
 Thu May 25 12:42:17 2017
@@ -39,6 +39,7 @@ void test_no_inner_alloc()
 using SA = std::scoped_allocator_adaptor;
 static_assert(std::uses_allocator::value, 
"");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Alloc CA(P);
 SA A(CA);
 A.construct(ptr);
@@ -61,6 +62,7 @@ void test_no_inner_alloc()
 using SA = std::scoped_allocator_adaptor;
 static_assert(std::uses_allocator::value, 
"");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Alloc CA(P);
 SA A(CA);
 A.construct(ptr);
@@ -77,7 +79,6 @@ void test_no_inner_alloc()
 
 void test_with_inner_alloc()
 {
-using VoidAlloc1 = CountingAllocator;
 using VoidAlloc2 = CountingAllocator;
 
 AllocController POuter;
@@ -93,6 +94,7 @@ void test_with_inner_alloc()
 static_assert(!std::uses_allocator::value, "");
 static_assert(std::uses_allocator::value, "");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Outer O(POuter);
 Inner I(PInner);
 SA A(O, I);
@@ -119,6 +121,7 @@ void test_with_inner_alloc()
 static_assert(!std::uses_allocator::value, "");
 static_assert(std::uses_allocator::value, "");
 Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+assert(ptr);
 Outer O(POuter);
 Inner I(PInner);
 SA A(O, I);

Added: 
libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp?rev=303888=auto
==
--- 
libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
 (added)
+++ 
libcxx/trunk/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp
 Thu May 25 12:42:17 2017
@@ -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.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03
+
+// Verify TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION.
+
+#include 
+
+#include "test_workarounds.h"
+
+template
+struct identity {
+using type = T;
+};
+
+template struct list {};
+
+// C1XX believes this function template is not viable when LArgs is an empty
+// parameter pack.
+template 
+int f2(typename identity::type..., int i) {
+return i;
+}
+
+#ifdef TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION
+// C1XX believes this function template *is* viable when LArgs is an empty
+// parameter pack. Conforming compilers believe the two overloads are
+// ambiguous when LArgs is an empty pack.
+template 
+int f2(int i) {
+return i;
+}
+#endif
+
+template 
+int f1(list, Args&&... args) {
+return f2(args...);
+}
+
+int main() {
+f1(list<>{}, 42);
+}

Modified: libcxx/trunk/test/support/test_workarounds.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_workarounds.h?rev=303888=303887=303888=diff
==
--- libcxx/trunk/test/support/test_workarounds.h (original)
+++ libcxx/trunk/test/support/test_workarounds.h Thu May 25 12:42:17 2017
@@ -20,6 +20,7 @@
 #if 

[libcxx] r302944 - [test] Avoid P0138R2, direct-list-init of fixed enums from integers, part 1/3.

2017-05-12 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Fri May 12 15:33:32 2017
New Revision: 302944

URL: http://llvm.org/viewvc/llvm-project?rev=302944=rev
Log:
[test] Avoid P0138R2, direct-list-init of fixed enums from integers, part 1/3.

This C++17 Core Language feature isn't necessary when testing std::byte.
It's a minor convenience, but it limits test coverage to very new compilers.

This part changes the code.

Fixes D32386.

Modified:

libcxx/trunk/test/std/language.support/support.types/byteops/and.assign.pass.cpp
libcxx/trunk/test/std/language.support/support.types/byteops/and.pass.cpp

libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp
libcxx/trunk/test/std/language.support/support.types/byteops/lshift.fail.cpp
libcxx/trunk/test/std/language.support/support.types/byteops/lshift.pass.cpp
libcxx/trunk/test/std/language.support/support.types/byteops/not.pass.cpp

libcxx/trunk/test/std/language.support/support.types/byteops/or.assign.pass.cpp
libcxx/trunk/test/std/language.support/support.types/byteops/or.pass.cpp

libcxx/trunk/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp
libcxx/trunk/test/std/language.support/support.types/byteops/rshift.fail.cpp
libcxx/trunk/test/std/language.support/support.types/byteops/rshift.pass.cpp

libcxx/trunk/test/std/language.support/support.types/byteops/to_integer.fail.cpp

libcxx/trunk/test/std/language.support/support.types/byteops/to_integer.pass.cpp

libcxx/trunk/test/std/language.support/support.types/byteops/xor.assign.pass.cpp
libcxx/trunk/test/std/language.support/support.types/byteops/xor.pass.cpp

Modified: 
libcxx/trunk/test/std/language.support/support.types/byteops/and.assign.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/byteops/and.assign.pass.cpp?rev=302944=302943=302944=diff
==
--- 
libcxx/trunk/test/std/language.support/support.types/byteops/and.assign.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.types/byteops/and.assign.pass.cpp
 Fri May 12 15:33:32 2017
@@ -26,9 +26,9 @@ constexpr std::byte test(std::byte b1, s
 
 int main () {
std::byte b;  // not constexpr, just used in noexcept check
-   constexpr std::byte b1{1};
-   constexpr std::byte b8{8};
-   constexpr std::byte b9{9};
+   constexpr std::byte b1{static_cast(1)};
+   constexpr std::byte b8{static_cast(8)};
+   constexpr std::byte b9{static_cast(9)};
 
static_assert(noexcept(b &= b), "" );
 

Modified: 
libcxx/trunk/test/std/language.support/support.types/byteops/and.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/byteops/and.pass.cpp?rev=302944=302943=302944=diff
==
--- libcxx/trunk/test/std/language.support/support.types/byteops/and.pass.cpp 
(original)
+++ libcxx/trunk/test/std/language.support/support.types/byteops/and.pass.cpp 
Fri May 12 15:33:32 2017
@@ -18,9 +18,9 @@
 // constexpr byte operator&(byte l, byte r) noexcept;
 
 int main () {
-   constexpr std::byte b1{1};
-   constexpr std::byte b8{8};
-   constexpr std::byte b9{9};
+   constexpr std::byte b1{static_cast(1)};
+   constexpr std::byte b8{static_cast(8)};
+   constexpr std::byte b9{static_cast(9)};
 
static_assert(noexcept(b1 & b8), "" );
 

Modified: 
libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp?rev=302944=302943=302944=diff
==
--- 
libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp
 Fri May 12 15:33:32 2017
@@ -28,8 +28,8 @@ constexpr std::byte test(std::byte b) {
 
 int main () {
std::byte b;  // not constexpr, just used in noexcept check
-   constexpr std::byte b2{2};
-   constexpr std::byte b3{3};
+   constexpr std::byte b2{static_cast(2)};
+   constexpr std::byte b3{static_cast(3)};
 
static_assert(noexcept(b <<= 2), "" );
 

Modified: 
libcxx/trunk/test/std/language.support/support.types/byteops/lshift.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/byteops/lshift.fail.cpp?rev=302944=302943=302944=diff
==
--- 
libcxx/trunk/test/std/language.support/support.types/byteops/lshift.fail.cpp 
(original)
+++ 
libcxx/trunk/test/std/language.support/support.types/byteops/lshift.fail.cpp 
Fri May 12 15:33:32 2017
@@ -21,6 +21,6 @@
 //   is_integral_v 

[libcxx] r302946 - [test] Add specific test for P0138R2, direct-list-init of fixed enums from integers, part 3/3.

2017-05-12 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Fri May 12 15:33:46 2017
New Revision: 302946

URL: http://llvm.org/viewvc/llvm-project?rev=302946=rev
Log:
[test] Add specific test for P0138R2, direct-list-init of fixed enums from 
integers, part 3/3.

Test the C++17 Core Language feature independently from other std::byte tests.

Added:

libcxx/trunk/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp

Added: 
libcxx/trunk/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp?rev=302946=auto
==
--- 
libcxx/trunk/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp
 (added)
+++ 
libcxx/trunk/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp
 Fri May 12 15:33:46 2017
@@ -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.
+//
+//===--===//
+
+#include 
+#include 
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// The following compilers don't like "std::byte b1{1}"
+// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8
+// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0
+
+int main () {
+  constexpr std::byte b{42};
+  static_assert(std::to_integer(b) == 42, "");
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r302945 - [test] Avoid P0138R2, direct-list-init of fixed enums from integers, part 2/3.

2017-05-12 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Fri May 12 15:33:41 2017
New Revision: 302945

URL: http://llvm.org/viewvc/llvm-project?rev=302945=rev
Log:
[test] Avoid P0138R2, direct-list-init of fixed enums from integers, part 2/3.

This C++17 Core Language feature isn't necessary when testing std::byte.
It's a minor convenience, but it limits test coverage to very new compilers.

This part activates the tests for more compilers.

Modified:

libcxx/trunk/test/std/language.support/support.types/byteops/and.assign.pass.cpp
libcxx/trunk/test/std/language.support/support.types/byteops/and.pass.cpp

libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp
libcxx/trunk/test/std/language.support/support.types/byteops/lshift.fail.cpp
libcxx/trunk/test/std/language.support/support.types/byteops/lshift.pass.cpp
libcxx/trunk/test/std/language.support/support.types/byteops/not.pass.cpp

libcxx/trunk/test/std/language.support/support.types/byteops/or.assign.pass.cpp
libcxx/trunk/test/std/language.support/support.types/byteops/or.pass.cpp

libcxx/trunk/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp
libcxx/trunk/test/std/language.support/support.types/byteops/rshift.fail.cpp
libcxx/trunk/test/std/language.support/support.types/byteops/rshift.pass.cpp

libcxx/trunk/test/std/language.support/support.types/byteops/to_integer.fail.cpp

libcxx/trunk/test/std/language.support/support.types/byteops/to_integer.pass.cpp

libcxx/trunk/test/std/language.support/support.types/byteops/xor.assign.pass.cpp
libcxx/trunk/test/std/language.support/support.types/byteops/xor.pass.cpp

Modified: 
libcxx/trunk/test/std/language.support/support.types/byteops/and.assign.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/byteops/and.assign.pass.cpp?rev=302945=302944=302945=diff
==
--- 
libcxx/trunk/test/std/language.support/support.types/byteops/and.assign.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.types/byteops/and.assign.pass.cpp
 Fri May 12 15:33:41 2017
@@ -11,9 +11,6 @@
 #include 
 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
-// The following compilers don't like "std::byte b1{1}"
-// UNSUPPORTED: clang-3.5, clang-3.6, clang-3.7, clang-3.8
-// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0
 
 // constexpr byte& operator &=(byte l, byte r) noexcept;
 

Modified: 
libcxx/trunk/test/std/language.support/support.types/byteops/and.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/byteops/and.pass.cpp?rev=302945=302944=302945=diff
==
--- libcxx/trunk/test/std/language.support/support.types/byteops/and.pass.cpp 
(original)
+++ libcxx/trunk/test/std/language.support/support.types/byteops/and.pass.cpp 
Fri May 12 15:33:41 2017
@@ -11,9 +11,6 @@
 #include 
 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
-// The following compilers don't like "std::byte b1{1}"
-// UNSUPPORTED: clang-3.5, clang-3.6, clang-3.7, clang-3.8
-// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0
 
 // constexpr byte operator&(byte l, byte r) noexcept;
 

Modified: 
libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp?rev=302945=302944=302945=diff
==
--- 
libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp
 Fri May 12 15:33:41 2017
@@ -11,9 +11,6 @@
 #include 
 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
-// The following compilers don't like "std::byte b1{1}"
-// UNSUPPORTED: clang-3.5, clang-3.6, clang-3.7, clang-3.8
-// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0
 
 // template 
 //   constexpr byte& operator<<=(byte& b, IntegerType shift) noexcept;

Modified: 
libcxx/trunk/test/std/language.support/support.types/byteops/lshift.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/byteops/lshift.fail.cpp?rev=302945=302944=302945=diff
==
--- 
libcxx/trunk/test/std/language.support/support.types/byteops/lshift.fail.cpp 
(original)
+++ 
libcxx/trunk/test/std/language.support/support.types/byteops/lshift.fail.cpp 
Fri May 12 15:33:41 2017
@@ -11,9 +11,6 @@
 #include 
 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
-// The following compilers don't like "std::byte b1{1}"
-// UNSUPPORTED: clang-3.5, clang-3.6, clang-3.7, clang-3.8
-// UNSUPPORTED: apple-clang-6, apple-clang-7, 

[libcxx] r302707 - [test] support machinery changes for EDG & C1XX /Za

2017-05-10 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Wed May 10 14:10:49 2017
New Revision: 302707

URL: http://llvm.org/viewvc/llvm-project?rev=302707=rev
Log:
[test] support machinery changes for EDG & C1XX /Za

This change works around a couple of bugs:

1. EDG doesn't like explicit constexpr in a derived class. This program:

  struct Base {};
  struct Derived : Base {
  constexpr Derived() = default;
  };

  triggers "error: defaulted default constructor cannot be constexpr."

2. C1XX with /Za has no idea which constructor needs to be valid for copy 
elision.

The change also conditionally disables parts of the 
msvc_stdlib_force_include.hpp header that conflict with external configuration 
when _LIBCXX_IN_DEVCRT is defined.

Differential Revision: https://reviews.llvm.org/D32778

Added:

libcxx/trunk/test/support/test.workarounds/c1xx_broken_za_ctor_check.pass.cpp
Modified:
libcxx/trunk/test/support/archetypes.hpp
libcxx/trunk/test/support/archetypes.ipp
libcxx/trunk/test/support/msvc_stdlib_force_include.hpp
libcxx/trunk/test/support/test_macros.h
libcxx/trunk/test/support/test_workarounds.h

Modified: libcxx/trunk/test/support/archetypes.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/archetypes.hpp?rev=302707=302706=302707=diff
==
--- libcxx/trunk/test/support/archetypes.hpp (original)
+++ libcxx/trunk/test/support/archetypes.hpp Wed May 10 14:10:49 2017
@@ -5,6 +5,7 @@
 #include 
 
 #include "test_macros.h"
+#include "test_workarounds.h"
 
 #if TEST_STD_VER >= 11
 
@@ -14,7 +15,9 @@ template 
 struct DepType : T {};
 
 struct NullBase {
+#ifndef TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK
 protected:
+#endif // !TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK
   NullBase() = default;
   NullBase(NullBase const&) = default;
   NullBase& operator=(NullBase const&) = default;
@@ -81,7 +84,9 @@ struct TestBase {
   ++assigned; ++value_assigned;
   return *this;
 }
+#ifndef TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK
 protected:
+#endif // !TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK
 ~TestBase() {
   assert(value != -999); assert(alive > 0);
   --alive; ++destroyed; value = -999;
@@ -144,7 +149,9 @@ struct ValueBase {
 }
 //~ValueBase() { assert(value != -999); value = -999; }
 int value;
+#ifndef TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK
 protected:
+#endif // !TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK
 constexpr static int check_value(int const& val) {
 #if TEST_STD_VER < 14
   return val == -1 || val == 999 ? (TEST_THROW(42), 0) : val;
@@ -197,7 +204,9 @@ struct TrivialValueBase {
 template ::type = true>
 constexpr TrivialValueBase(std::initializer_list& il, int = 0) : 
value(static_cast(il.size())) {}
 int value;
+#ifndef TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK
 protected:
+#endif // !TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK
 constexpr TrivialValueBase() noexcept : value(0) {}
 };
 

Modified: libcxx/trunk/test/support/archetypes.ipp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/archetypes.ipp?rev=302707=302706=302707=diff
==
--- libcxx/trunk/test/support/archetypes.ipp (original)
+++ libcxx/trunk/test/support/archetypes.ipp Wed May 10 14:10:49 2017
@@ -6,7 +6,11 @@
 #define DEFINE_EXPLICIT
 #endif
 #ifndef DEFINE_CONSTEXPR
+#ifdef TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR
+#define DEFINE_CONSTEXPR
+#else // TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR
 #define DEFINE_CONSTEXPR constexpr
+#endif // TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR
 #endif
 #ifndef DEFINE_ASSIGN_CONSTEXPR
 #if TEST_STD_VER >= 14

Modified: libcxx/trunk/test/support/msvc_stdlib_force_include.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/msvc_stdlib_force_include.hpp?rev=302707=302706=302707=diff
==
--- libcxx/trunk/test/support/msvc_stdlib_force_include.hpp (original)
+++ libcxx/trunk/test/support/msvc_stdlib_force_include.hpp Wed May 10 14:10:49 
2017
@@ -13,11 +13,13 @@
 // This header is force-included when running the libc++ tests against the
 // MSVC standard library.
 
-// Silence warnings about CRT machinery.
-#define _CRT_SECURE_NO_WARNINGS
-
-// Avoid assertion dialogs.
-#define _CRT_SECURE_INVALID_PARAMETER(EXPR) ::abort()
+#ifndef _LIBCXX_IN_DEVCRT
+// Silence warnings about CRT machinery.
+#define _CRT_SECURE_NO_WARNINGS
+
+// Avoid assertion dialogs.
+#define _CRT_SECURE_INVALID_PARAMETER(EXPR) ::abort()
+#endif // _LIBCXX_IN_DEVCRT
 
 #include 
 #include 
@@ -31,6 +33,7 @@
 #define _MSVC_STL_VER 42
 #endif
 
+#ifndef _LIBCXX_IN_DEVCRT
 struct AssertionDialogAvoider {
 AssertionDialogAvoider() {
 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
@@ -42,6 +45,7 @@ struct AssertionDialogAvoider {
 };
 
 const 

[libcxx] r302162 - [test] Name the local variable in the C1XX implementation of DoNotOptmize

2017-05-04 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Thu May  4 10:54:09 2017
New Revision: 302162

URL: http://llvm.org/viewvc/llvm-project?rev=302162=rev
Log:
[test] Name the local variable in the C1XX implementation of DoNotOptmize

Differential Revision: https://reviews.llvm.org/D32510

Modified:
libcxx/trunk/test/support/test_macros.h

Modified: libcxx/trunk/test/support/test_macros.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_macros.h?rev=302162=302161=302162=diff
==
--- libcxx/trunk/test/support/test_macros.h (original)
+++ libcxx/trunk/test/support/test_macros.h Thu May  4 10:54:09 2017
@@ -209,7 +209,8 @@ inline void DoNotOptimize(Tp const& valu
 #include 
 template 
 inline void DoNotOptimize(Tp const& value) {
-  const volatile void* volatile = __builtin_addressof(value);
+  const volatile void* volatile unused = __builtin_addressof(value);
+  static_cast(unused);
   _ReadWriteBarrier();
 }
 #endif


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r301055 - Expand test coverage for LWG2857

2017-04-21 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Fri Apr 21 17:38:59 2017
New Revision: 301055

URL: http://llvm.org/viewvc/llvm-project?rev=301055=rev
Log:
Expand test coverage for LWG2857

* Cover optional's emplace-from-initializer_list overload

* Verify that any::emplace and optional::emplace return a reference to the 
correct type even for throwing cases.

Differential Revision: https://reviews.llvm.org/D32106

Modified:
libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp?rev=301055=301054=301055=diff
==
--- 
libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp 
Fri Apr 21 17:38:59 2017
@@ -44,7 +44,7 @@ void test_emplace_type() {
 
 auto  = a.emplace();
 static_assert( std::is_same_v, "" );
-   assert( == std::any_cast());
+assert( == std::any_cast());
 
 assert(Tracked::count == 0);
 assert(Type::count == 1);
@@ -60,7 +60,7 @@ void test_emplace_type() {
 
 auto  = a.emplace(101);
 static_assert( std::is_same_v, "" );
-   assert( == std::any_cast());
+assert( == std::any_cast());
 
 assert(Tracked::count == 0);
 assert(Type::count == 1);
@@ -76,7 +76,7 @@ void test_emplace_type() {
 
 auto  = a.emplace(-1, 42, -1);
 static_assert( std::is_same_v, "" );
-   assert( == std::any_cast());
+assert( == std::any_cast());
 
 assert(Tracked::count == 0);
 assert(Type::count == 1);
@@ -97,7 +97,7 @@ void test_emplace_type_tracked() {
 assert(Tracked::count == 1);
 auto  = a.emplace();
 static_assert( std::is_same_v, "" );
-   assert( == std::any_cast());
+assert( == std::any_cast());
 
 assert(Tracked::count == 0);
 assertArgsMatch(a);
@@ -107,7 +107,7 @@ void test_emplace_type_tracked() {
 assert(Tracked::count == 1);
 auto  = a.emplace(-1, 42, -1);
 static_assert( std::is_same_v, "" );
-   assert( == std::any_cast());
+assert( == std::any_cast());
 
 assert(Tracked::count == 0);
 assertArgsMatch(a);
@@ -118,7 +118,7 @@ void test_emplace_type_tracked() {
 assert(Tracked::count == 1);
 auto  = a.emplace({-1, 42, -1});
 static_assert( std::is_same_v, "" );
-   assert( == std::any_cast());
+assert( == std::any_cast());
 
 assert(Tracked::count == 0);
 assertArgsMatch(a);
@@ -129,7 +129,7 @@ void test_emplace_type_tracked() {
 assert(Tracked::count == 1);
 auto  = a.emplace({-1, 42, -1}, x);
 static_assert( std::is_same_v, "" );
-   assert( == std::any_cast());
+assert( == std::any_cast());
 
 assert(Tracked::count == 0);
 assertArgsMatch(a);
@@ -159,7 +159,8 @@ void test_emplace_throws()
 std::any a(small{42});
 assert(small::count == 1);
 try {
-a.emplace(101);
+auto  = a.emplace(101);
+static_assert( std::is_same_v, "" );
 assert(false);
 } catch (int const&) {
 }
@@ -169,7 +170,8 @@ void test_emplace_throws()
 std::any a(small{42});
 assert(small::count == 1);
 try {
-a.emplace({1, 2, 3}, 101);
+auto  = a.emplace({1, 2, 3}, 101);
+static_assert( std::is_same_v, "" );
 assert(false);
 } catch (int const&) {
 }
@@ -180,7 +182,8 @@ void test_emplace_throws()
 std::any a(large{42});
 assert(large::count == 1);
 try {
-a.emplace(101);
+auto  = a.emplace(101);
+static_assert( std::is_same_v, "" );
 assert(false);
 } catch (int const&) {
 }
@@ -190,7 +193,8 @@ void test_emplace_throws()
 std::any a(large{42});
 assert(large::count == 1);
 try {
-a.emplace({1, 2, 3}, 101);
+auto  = a.emplace({1, 2, 3}, 101);
+static_assert( std::is_same_v, "" );
 assert(false);
 } catch 

[libcxx] r300581 - [test] Silence another unused-typedef warning

2017-04-18 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Tue Apr 18 15:04:39 2017
New Revision: 300581

URL: http://llvm.org/viewvc/llvm-project?rev=300581=rev
Log:
[test] Silence another unused-typedef warning

Modified:

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp?rev=300581=300580=300581=diff
==
--- 
libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp
 Tue Apr 18 15:04:39 2017
@@ -78,7 +78,6 @@ void test_sfinae() {
   using DA = NCConvertingDeleter;// non-copyable deleters
   using DAC = NCConvertingDeleter; // non-copyable deleters
 
-  using DB = NCConvertingDeleter;
   using UA = std::unique_ptr;
   using UAC = std::unique_ptr;
   using UAD = std::unique_ptr;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r300575 - [test] Silence unused parameter/typedef warnings

2017-04-18 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Tue Apr 18 13:44:33 2017
New Revision: 300575

URL: http://llvm.org/viewvc/llvm-project?rev=300575=rev
Log:
[test] Silence unused parameter/typedef warnings

Modified:

libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp

libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp

Modified: 
libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp?rev=300575=300574=300575=diff
==
--- 
libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp
 Tue Apr 18 13:44:33 2017
@@ -113,7 +113,7 @@ int main()
 std::throw_with_nested("String literal");
 assert(false);
 }
-catch (const char * s)
+catch (const char *)
 {
 }
 }

Modified: 
libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp?rev=300575=300574=300575=diff
==
--- 
libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp
 Tue Apr 18 13:44:33 2017
@@ -81,11 +81,9 @@ void test_sfinae() {
   using DB = NCConvertingDeleter;
   using UA = std::unique_ptr;
   using UAC = std::unique_ptr;
-  using UB = std::unique_ptr;
   using UAD = std::unique_ptr;
   using UACD = std::unique_ptr;
 
-  using UBD = std::unique_ptr;
   { // cannot move from an lvalue
 static_assert(std::is_assignable::value, "");
 static_assert(!std::is_assignable::value, "");

Modified: 
libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp?rev=300575=300574=300575=diff
==
--- 
libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp
 Tue Apr 18 13:44:33 2017
@@ -46,7 +46,7 @@ struct NonDefaultDeleter {
 template 
 void test_sfinae() {
 #if TEST_STD_VER >= 11
-  { // the constructor does not participate in overload resultion when
+  { // the constructor does not participate in overload resolution when
 // the deleter is a pointer type
 using U = std::unique_ptr;
 static_assert(!std::is_default_constructible::value, "");


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r300488 - [optional] Update synopsis for LWG2934

2017-04-17 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Mon Apr 17 15:15:16 2017
New Revision: 300488

URL: http://llvm.org/viewvc/llvm-project?rev=300488=rev
Log:
[optional] Update synopsis for LWG2934

(comment-only change)

Modified:
libcxx/trunk/include/optional
libcxx/trunk/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp

libcxx/trunk/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp

libcxx/trunk/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp

libcxx/trunk/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp

libcxx/trunk/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp

libcxx/trunk/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp
libcxx/trunk/test/std/utilities/optional/optional.relops/equal.pass.cpp

libcxx/trunk/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp

libcxx/trunk/test/std/utilities/optional/optional.relops/greater_than.pass.cpp
libcxx/trunk/test/std/utilities/optional/optional.relops/less_equal.pass.cpp
libcxx/trunk/test/std/utilities/optional/optional.relops/less_than.pass.cpp
libcxx/trunk/test/std/utilities/optional/optional.relops/not_equal.pass.cpp

Modified: libcxx/trunk/include/optional
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/optional?rev=300488=300487=300488=diff
==
--- libcxx/trunk/include/optional (original)
+++ libcxx/trunk/include/optional Mon Apr 17 15:15:16 2017
@@ -17,29 +17,31 @@
 // C++1z
 
 namespace std {
-  // 20.6.3, optional for object types
+  // 23.6.3, optional for object types
   template  class optional;
 
-  // 20.6.4, no-value state indicator
+  // 23.6.4, no-value state indicator
   struct nullopt_t{see below };
   constexpr nullopt_t nullopt(unspecified );
 
-  // 20.6.5, class bad_optional_access
+  // 23.6.5, class bad_optional_access
   class bad_optional_access;
 
-  // 20.6.6, relational operators
-  template 
-  constexpr bool operator==(const optional&, const optional&);
-  template 
-  constexpr bool operator!=(const optional&, const optional&);
-  template 
-  constexpr bool operator<(const optional&, const optional&);
-  template 
-  constexpr bool operator>(const optional&, const optional&);
-  template 
-  constexpr bool operator<=(const optional&, const optional&);
-  template 
-  constexpr bool operator>=(const optional&, const optional&);
+  // 23.6.6, relational operators
+  template 
+  constexpr bool operator==(const optional&, const optional&);
+  template 
+  constexpr bool operator!=(const optional&, const optional&);
+  template 
+  constexpr bool operator<(const optional&, const optional&);
+  template 
+  constexpr bool operator>(const optional&, const optional&);
+  template 
+  constexpr bool operator<=(const optional&, const optional&);
+  template 
+  constexpr bool operator>=(const optional&, const optional&);
+
+  // 23.6.7 comparison with nullopt
   template  constexpr bool operator==(const optional&, nullopt_t) 
noexcept;
   template  constexpr bool operator==(nullopt_t, const optional&) 
noexcept;
   template  constexpr bool operator!=(const optional&, nullopt_t) 
noexcept;
@@ -53,21 +55,21 @@ namespace std {
   template  constexpr bool operator>=(const optional&, nullopt_t) 
noexcept;
   template  constexpr bool operator>=(nullopt_t, const optional&) 
noexcept;
 
-  // 20.6.8, comparison with T
-  template  constexpr bool operator==(const optional&, const T&);
-  template  constexpr bool operator==(const T&, const optional&);
-  template  constexpr bool operator!=(const optional&, const T&);
-  template  constexpr bool operator!=(const T&, const optional&);
-  template  constexpr bool operator<(const optional&, const T&);
-  template  constexpr bool operator<(const T&, const optional&);
-  template  constexpr bool operator<=(const optional&, const T&);
-  template  constexpr bool operator<=(const T&, const optional&);
-  template  constexpr bool operator>(const optional&, const T&);
-  template  constexpr bool operator>(const T&, const optional&);
-  template  constexpr bool operator>=(const optional&, const T&);
-  template  constexpr bool operator>=(const T&, const optional&);
+  // 23.6.8, comparison with T
+  template  constexpr bool operator==(const optional&, 
const U&);
+  template  constexpr bool operator==(const U&, const 
optional&);
+  template  constexpr bool operator!=(const optional&, 
const U&);
+  template  constexpr bool operator!=(const U&, const 
optional&);
+  template  constexpr bool operator<(const optional&, 
const U&);
+  template  constexpr bool operator<(const U&, const 
optional&);
+  template  constexpr bool operator<=(const optional&, 
const U&);
+  template  constexpr bool operator<=(const U&, const 
optional&);
+  template  constexpr bool operator>(const optional&, 
const U&);
+  template  constexpr bool operator>(const U&, const 
optional&);
+  

[libcxx] r288760 - std::get<0>([std::variant constant expression]) *is* noexcept.

2016-12-05 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Mon Dec  5 20:28:19 2016
New Revision: 288760

URL: http://llvm.org/viewvc/llvm-project?rev=288760=rev
Log:
std::get<0>([std::variant constant expression]) *is* noexcept.

Differential review: http://reviews.llvm.org/D27436

Modified:
libcxx/trunk/test/std/utilities/variant/variant.get/get_index.pass.cpp
libcxx/trunk/test/std/utilities/variant/variant.get/get_type.pass.cpp

Modified: libcxx/trunk/test/std/utilities/variant/variant.get/get_index.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.get/get_index.pass.cpp?rev=288760=288759=288760=diff
==
--- libcxx/trunk/test/std/utilities/variant/variant.get/get_index.pass.cpp 
(original)
+++ libcxx/trunk/test/std/utilities/variant/variant.get/get_index.pass.cpp Mon 
Dec  5 20:28:19 2016
@@ -36,16 +36,35 @@ void test_const_lvalue_get() {
   {
 using V = std::variant;
 constexpr V v(42);
-ASSERT_NOT_NOEXCEPT(std::get<0>(v));
+#ifndef __clang__ // Avoid https://llvm.org/bugs/show_bug.cgi?id=15481
+ASSERT_NOEXCEPT(std::get<0>(v));
+#endif
 ASSERT_SAME_TYPE(decltype(std::get<0>(v)), const int &);
 static_assert(std::get<0>(v) == 42, "");
   }
   {
 using V = std::variant;
+const V v(42);
+ASSERT_NOT_NOEXCEPT(std::get<0>(v));
+ASSERT_SAME_TYPE(decltype(std::get<0>(v)), const int &);
+assert(std::get<0>(v) == 42);
+  }
+  {
+using V = std::variant;
 constexpr V v(42l);
+#ifndef __clang__ // Avoid https://llvm.org/bugs/show_bug.cgi?id=15481
+ASSERT_NOEXCEPT(std::get<1>(v));
+#endif
 ASSERT_SAME_TYPE(decltype(std::get<1>(v)), const long &);
 static_assert(std::get<1>(v) == 42, "");
   }
+  {
+using V = std::variant;
+const V v(42l);
+ASSERT_NOT_NOEXCEPT(std::get<1>(v));
+ASSERT_SAME_TYPE(decltype(std::get<1>(v)), const long &);
+assert(std::get<1>(v) == 42);
+  }
 // FIXME: Remove these once reference support is reinstated
 #if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
   {

Modified: libcxx/trunk/test/std/utilities/variant/variant.get/get_type.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.get/get_type.pass.cpp?rev=288760=288759=288760=diff
==
--- libcxx/trunk/test/std/utilities/variant/variant.get/get_type.pass.cpp 
(original)
+++ libcxx/trunk/test/std/utilities/variant/variant.get/get_type.pass.cpp Mon 
Dec  5 20:28:19 2016
@@ -30,16 +30,35 @@ void test_const_lvalue_get() {
   {
 using V = std::variant;
 constexpr V v(42);
-ASSERT_NOT_NOEXCEPT(std::get(v));
+#ifndef __clang__ // Avoid https://llvm.org/bugs/show_bug.cgi?id=15481
+ASSERT_NOEXCEPT(std::get(v));
+#endif
 ASSERT_SAME_TYPE(decltype(std::get<0>(v)), const int &);
 static_assert(std::get(v) == 42, "");
   }
   {
 using V = std::variant;
+const V v(42);
+ASSERT_NOT_NOEXCEPT(std::get(v));
+ASSERT_SAME_TYPE(decltype(std::get<0>(v)), const int &);
+assert(std::get(v) == 42);
+  }
+  {
+using V = std::variant;
 constexpr V v(42l);
+#ifndef __clang__ // Avoid https://llvm.org/bugs/show_bug.cgi?id=15481
+ASSERT_NOEXCEPT(std::get(v));
+#endif
 ASSERT_SAME_TYPE(decltype(std::get(v)), const long &);
 static_assert(std::get(v) == 42, "");
   }
+  {
+using V = std::variant;
+const V v(42l);
+ASSERT_NOT_NOEXCEPT(std::get(v));
+ASSERT_SAME_TYPE(decltype(std::get(v)), const long &);
+assert(std::get(v) == 42);
+  }
 // FIXME: Remove these once reference support is reinstated
 #if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
   {


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r287732 - Don't "LIBCPP_ONLY(stuff;)" at namespace scope.

2016-11-22 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Tue Nov 22 19:44:53 2016
New Revision: 287732

URL: http://llvm.org/viewvc/llvm-project?rev=287732=rev
Log:
Don't "LIBCPP_ONLY(stuff;)" at namespace scope.

Differential review: https://reviews.llvm.org/D27029

Modified:

libcxx/trunk/test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp?rev=287732=287731=287732=diff
==
--- 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp
 Tue Nov 22 19:44:53 2016
@@ -577,10 +577,10 @@ void test_swap_noexcept() {
   }
 }
 
-
+#ifdef _LIBCPP_VERSION
 // This is why variant should SFINAE member swap. :-)
-LIBCPP_ONLY(template class std::variant;)
-
+template class std::variant;
+#endif
 
 int main() {
   test_swap_valueless_by_exception();


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27029: [libc++] [test] Unbreak variant::swap test for non-libc++ libraries

2016-11-22 Thread Casey Carter via cfe-commits
CaseyCarter created this revision.
CaseyCarter added reviewers: EricWF, mclow.lists.
CaseyCarter added a subscriber: cfe-commits.

`LIBCPP_ONLY(foo;)` at namespace scope is bad, and it should feel bad.


https://reviews.llvm.org/D27029

Files:
  test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp


Index: test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp
===
--- test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp
+++ test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp
@@ -577,10 +577,10 @@
   }
 }
 
-
+#ifdef _LIBCPP_VERSION
 // This is why variant should SFINAE member swap. :-)
-LIBCPP_ONLY(template class std::variant;)
-
+template class std::variant;
+#endif
 
 int main() {
   test_swap_valueless_by_exception();


Index: test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp
===
--- test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp
+++ test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp
@@ -577,10 +577,10 @@
   }
 }
 
-
+#ifdef _LIBCPP_VERSION
 // This is why variant should SFINAE member swap. :-)
-LIBCPP_ONLY(template class std::variant;)
-
+template class std::variant;
+#endif
 
 int main() {
   test_swap_valueless_by_exception();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26903: [libcxx] Add tests (but not implementation)

2016-11-22 Thread Casey Carter via cfe-commits
CaseyCarter added inline comments.



Comment at: 
test/std/utilities/variant/variant.helpers/variant_alternative.pass.cpp:33
+void test() {
+static_assert(std::is_same_v<
+typename std::variant_alternative::type, E>, "");

STL_MSFT wrote:
> EricWF wrote:
> > STL_MSFT wrote:
> > > You aren't directly including  (not sure if 
> > > "variant_test_helpers.hpp" is).
> > Fixing this. Does your `` somehow not drag in ``?
> Of course  drags in , I'm just being nitpicky :-)
STL's internal compiler is well-known for being more strict than any shipping 
compiler.


https://reviews.llvm.org/D26903



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26903: [libcxx] Add tests (but not implementation)

2016-11-22 Thread Casey Carter via cfe-commits
CaseyCarter added a comment.

Other than the note in variant.variant\variant.swap\swap.pass.cpp, all passes 
pass and all fails fail with out implementation.




Comment at: 
test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp:487
+// This is why variant should SFINAE member hash. :-)
+template class std::variant;
+

This instantiates `variant::swap` without meeting the 
requirements thereof (i.e., our member swap does not SFINAE).


https://reviews.llvm.org/D26903



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26903: [libcxx] Add tests (but not implementation)

2016-11-22 Thread Casey Carter via cfe-commits
CaseyCarter added inline comments.



Comment at: test/std/utilities/variant/variant.hash/hash.pass.cpp:34
+
+void test_hash_variant()
+{

This is non-portable. The fact that both your implementation and mine pass this 
test suggests they both have poor QoI: There's strong opinion in the community 
that a variant's index should contribute to its hash value, so that e.g. 
`variant{in_place_index<0>, 42}` and `variant{in_place_index<1>, 42}` have differing hash values.



Comment at: test/std/utilities/variant/variant.helpers/variant_size.pass.cpp:41
+{
+test, 0>();
+test, 1>();

STL_MSFT wrote:
> Hmm, is this cromulent now that empty variants are forbidden?
It's not forbidden to *name* `variant<>`; it is forbidden to *instantiate* it. 
The pertinent specialization of `variant_size`:
```
template 
struct variant_size
  : integral_constant { };
```
is implicitly specified to not instantiate `variant`.


https://reviews.llvm.org/D26903



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26903: [libcxx] Add tests (but not implementation)

2016-11-21 Thread Casey Carter via cfe-commits
CaseyCarter added inline comments.



Comment at: test/std/utilities/variant/variant.relops/relops.pass.cpp:60
+inline bool operator>(MakeEmptyT const&, MakeEmptyT const&)  { assert(false); }
+inline bool operator>=(MakeEmptyT const&, MakeEmptyT const&) { assert(false); }
+

MSVC with /W4 is, uh, not found of these functions. Adding "return false;" 
after the assert shuts it up.



Comment at: test/std/utilities/variant/variant.relops/relops.pass.cpp:189
+V v2; makeEmpty(v2);
+assert(test_less(v1, v2, true, false));
+}

Bogus test: should be `assert(test_less(v1, v2, false, true));`. Maybe someone 
forgot to implement part of P0032?



Comment at: test/std/utilities/variant/variant.relops/relops.pass.cpp:195
+V v2;
+assert(test_less(v1, v2, false, true));
+}

Bogus test again: should be `assert(test_less(v1, v2, true, false));`.



Comment at: 
test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp:149
+static_assert(!std::is_nothrow_copy_assignable::value, "");
+}
+}

All four of these are non-portable. Implementations are permitted to strengthen 
noexcept, and these are assignments that can feasibly be implemented to not 
throw.



Comment at: 
test/std/utilities/variant/variant.variant/variant.mod/emplace_index_args.pass.cpp:92
+int y = 42;
+int z = 43;
+V v(std::in_place_index<0>, -1);

y and z are unused here,



Comment at: 
test/std/utilities/variant/variant.variant/variant.mod/emplace_type_args.pass.cpp:93
+int y = 42;
+int z = 43;
+V v(std::in_place_type, -1);

y and z are unused here.



Comment at: 
test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp:321
+// the variant swap is called on.
+assert(T::move_called == 1);
+assert(T::move_assign_called == 0);

Non-portable. Replace with `LIBCPP_ASSERT(T::move_called == 1); 
assert(T::move_called <= 2);`



Comment at: 
test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp:328
+assert(T::swap_called == 0);
+assert(T::move_called == 2);
+assert(T::move_assign_called == 0);

Non-portable. Replace with `LIBCPP_ASSERT(T::move_called == 2); 
assert(T::move_called <= 2);`



Comment at: 
test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp:349
+assert(T1::move_called == 1); // throws
+assert(T1::move_assign_called  == 0);
+assert(T2::move_called == 1);

Extra space before `==` here and on 370.



Comment at: 
test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp:350
+assert(T1::move_assign_called  == 0);
+assert(T2::move_called == 1);
+assert(std::get<0>(v1).value == 42);

Non-portable. Replace with `LIBCPP_ASSERT(T2::move_called == 1); 
assert(T2::move_called <= 1);`



Comment at: 
test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp:352
+assert(std::get<0>(v1).value == 42);
+assert(v2.valueless_by_exception());
+}

non-portable. s/b
```
if (T2::move_called != 0)
assert(v2.valueless_by_exception());
else
assert(std::get<1>(v2) == 100);
```




Comment at: 
test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp:367
+}
+assert(T2::move_called == 1);
+assert(T2::swap_called == 0);

This line is a dup of 369. `T1::move_called` was probably intended, in which 
case it is non-portable and should be `LIBCPP_ASSERT(T1::move_called == 1); 
assert(T1::move_called <= 1);`



Comment at: 
test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp:371
+assert(T2::move_assign_called  == 0);
+assert(std::get<0>(v1).value == 42);
+assert(std::get<1>(v2).value == 100);

Non-portable. S/b:
```
if (T1::move_called != 0)
assert(v1.valueless_by_exception());
else
assert(std::get<0>(v1).value == 42);
```



Comment at: 
test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp:375
+{
+using T1 = ThrowsOnSecondMove;
+using T2 = NonThrowingNonNoexceptType;

This test and the next are non-portable and I can't be bothered to fix them.



Comment at: 
test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp:403
+{
+// testing libc++ extension. If either variant stores a nothrow move
+// constructible type v1.swap(v2) provides the strong exception safety

I shouldn't have to point out that a test with the comment "testing libc++ 
extension" is 

[PATCH] D26903: [libcxx] Add tests (but not implementation)

2016-11-20 Thread Casey Carter via cfe-commits
CaseyCarter added a comment.

I'll take a look at these tomorrow; I don't have easy access to my 
implementation with the changes from P0510 and P0504 from home (it's waiting on 
a compiler bugfix to checkin).




Comment at: test/std/utilities/variant/variant.get/get_type.pass.cpp:18
+// template  constexpr const T& get(const 
variant& v);
+// template  constexpr const T&& get(const 
variant&& v); 
+

Space at end-of-line here.


https://reviews.llvm.org/D26903



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26782: [libcxx] [test] Test changes for P0504R0 "Revisiting in-place tag types for any/optional/variant"

2016-11-17 Thread Casey Carter via cfe-commits
CaseyCarter updated this revision to Diff 78379.
CaseyCarter marked an inline comment as done.
CaseyCarter added a comment.

Don't `STATIC_ASSERT`; `static_assert`.


https://reviews.llvm.org/D26782

Files:
  test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp
  test/std/utilities/any/any.class/any.cons/value.pass.cpp
  test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
  test/std/utilities/utility/utility.inplace/inplace.pass.cpp

Index: test/std/utilities/utility/utility.inplace/inplace.pass.cpp
===
--- test/std/utilities/utility/utility.inplace/inplace.pass.cpp
+++ test/std/utilities/utility/utility.inplace/inplace.pass.cpp
@@ -11,21 +11,24 @@
 
 // 
 
-// struct in_place_tag { in_place_tag() = delete; };
-//
-// using in_place_t = in_place_tag(&)(unspecified);
+// struct in_place_t {
+//   explicit in_place_t() = default;
+// };
+// inline constexpr in_place_t in_place{};
+
 // template 
-// using in_place_type_t = in_place_tag(&)(unspecified);
-// template 
-// using in_place_index_t = in_place_tag(&)(unspecified);
-//
-// in_place_tag in_place(unspecified);
-//
-// template ;
-// in_place_tag in_place(unspecified);
-//
-// template 
-// in_place_tag in_place(unspecified);
+//   struct in_place_type_t {
+// explicit in_place_type_t() = default;
+//   };
+// template 
+//   inline constexpr in_place_type_t in_place_type{};
+
+// template 
+//   struct in_place_index_t {
+// explicit in_place_index_t() = default;
+//   };
+// template 
+//   inline constexpr in_place_index_t in_place_index{};
 
 #include 
 #include 
@@ -34,66 +37,38 @@
 #include "test_macros.h"
 #include "type_id.h"
 
-template 
-struct CheckRet : std::false_type {};
-template 
-struct CheckRet : std::true_type {};
-
-TypeID const* test_fn(std::in_place_t) { return (); }
-template 
-TypeID const* test_fn(std::in_place_type_t)
-{ return (); }
-
-template 
-TypeID const* test_fn(std::in_place_index_t)
-{ return (); }
-
-// Concrete test overloads that don't have to be deduced.
-template 
-TypeID const* concrete_test_fn(Tag) {  return (); }
-
-template 
-bool check_tag_basic() {
-  using RawTp = typename std::remove_reference::type;
-  static_assert(std::is_lvalue_reference::value, "");
-  static_assert(std::is_function::value, "");
-  static_assert(CheckRet::value, "");
-  auto concrete_fn = concrete_test_fn;
-  return test_fn((Tp)std::in_place) == ()
-  && concrete_fn(std::in_place) == ();
+template 
+constexpr bool check_tag(Up) {
+return std::is_same::value
+&& std::is_same::value;
 }
 
 int main() {
-// test in_place_tag
-{
-static_assert(!std::is_default_constructible::value, "");
-}
 // test in_place_t
 {
 using T = std::in_place_t;
-assert(check_tag_basic());
-assert(test_fn((T)std::in_place) == ());
+static_assert(check_tag(std::in_place));
 }
 // test in_place_type_t
 {
 using T1 = std::in_place_type_t;
 using T2 = std::in_place_type_t;
 using T3 = std::in_place_type_t;
-assert(check_tag_basic());
-assert(check_tag_basic());
-assert(check_tag_basic());
-static_assert(!std::is_same::value && !std::is_same::value, "");
-static_assert(!std::is_same::value, "");
+static_assert(!std::is_same::value && !std::is_same::value);
+static_assert(!std::is_same::value);
+static_assert(check_tag(std::in_place_type));
+static_assert(check_tag(std::in_place_type));
+static_assert(check_tag(std::in_place_type));
 }
 // test in_place_index_t
 {
 using T1 = std::in_place_index_t<0>;
 using T2 = std::in_place_index_t<1>;
 using T3 = std::in_place_index_t;
-assert(check_tag_basic());
-assert(check_tag_basic());
-assert(check_tag_basic());
-static_assert(!std::is_same::value && !std::is_same::value, "");
-static_assert(!std::is_same::value, "");
+static_assert(!std::is_same::value && !std::is_same::value);
+static_assert(!std::is_same::value);
+static_assert(check_tag(std::in_place_index<0>));
+static_assert(check_tag(std::in_place_index<1>));
+static_assert(check_tag(std::in_place_index));
 }
-}
\ No newline at end of file
+}
Index: test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
===
--- test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
+++ test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
@@ -192,7 +192,6 @@
 Type::reset();
 {
 any a((Type(42)));
-   

[PATCH] D26782: [libcxx] [test] Test changes for P0504R0 "Revisiting in-place tag types for any/optional/variant"

2016-11-17 Thread Casey Carter via cfe-commits
CaseyCarter marked an inline comment as done.
CaseyCarter added a comment.

> Do these tests pass with the current `` implementation, or will they 
> have to wait?

These tests **do not pass** without making the changes required in P0504R0 to 
`` and ``.  (Interestingly  is unaffected; its use of 
`in_place_t` and `in_place` is source-compatible despite the changed 
definitions of those names.) I would have made those changes as well, but my 
request for permission to contribute changes to non-test code hasn't yet 
returned from the void into which I cast it. If neither of you get around to 
it, I may put an hour into it over the weekend.




Comment at: test/std/utilities/utility/utility.inplace/inplace.pass.cpp:40
 
-template 
-struct CheckRet : std::false_type {};
-template 
-struct CheckRet : std::true_type {};
+#define STATIC_ASSERT(...) static_assert((__VA_ARGS__), #__VA_ARGS__)
 

mclow.lists wrote:
> Please just use `static_assert(x)` instead.  Since this is C++1z only, you 
> don't need to supply a message. If the test fails, the compiler will give you 
> file and line #.
> 
> If I see an all caps `STATIC_ASSERT`, then my first bit of research has to be 
> "how is this different from `static_assert`?"
> 
`static_assert(false);` in Visual C++ diagnoses with the incredibly informative:

> inplace.pass.cpp(59): error C2607: static assertion failed

so I've developed this habit which inadvertently leaked into the diff. Fixing.


https://reviews.llvm.org/D26782



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26782: [libcxx] [test] Test changes for P0504R0 "Revisiting in-place tag types for any/optional/variant"

2016-11-16 Thread Casey Carter via cfe-commits
CaseyCarter updated this revision to Diff 78311.
CaseyCarter added a comment.

Remove unused reference variable in any_cast_reference.pass.cpp.


https://reviews.llvm.org/D26782

Files:
  test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp
  test/std/utilities/any/any.class/any.cons/value.pass.cpp
  test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
  test/std/utilities/utility/utility.inplace/inplace.pass.cpp

Index: test/std/utilities/utility/utility.inplace/inplace.pass.cpp
===
--- test/std/utilities/utility/utility.inplace/inplace.pass.cpp
+++ test/std/utilities/utility/utility.inplace/inplace.pass.cpp
@@ -11,21 +11,24 @@
 
 // 
 
-// struct in_place_tag { in_place_tag() = delete; };
-//
-// using in_place_t = in_place_tag(&)(unspecified);
+// struct in_place_t {
+//   explicit in_place_t() = default;
+// };
+// inline constexpr in_place_t in_place{};
+
 // template 
-// using in_place_type_t = in_place_tag(&)(unspecified);
-// template 
-// using in_place_index_t = in_place_tag(&)(unspecified);
-//
-// in_place_tag in_place(unspecified);
-//
-// template ;
-// in_place_tag in_place(unspecified);
-//
-// template 
-// in_place_tag in_place(unspecified);
+//   struct in_place_type_t {
+// explicit in_place_type_t() = default;
+//   };
+// template 
+//   inline constexpr in_place_type_t in_place_type{};
+
+// template 
+//   struct in_place_index_t {
+// explicit in_place_index_t() = default;
+//   };
+// template 
+//   inline constexpr in_place_index_t in_place_index{};
 
 #include 
 #include 
@@ -34,66 +37,40 @@
 #include "test_macros.h"
 #include "type_id.h"
 
-template 
-struct CheckRet : std::false_type {};
-template 
-struct CheckRet : std::true_type {};
+#define STATIC_ASSERT(...) static_assert((__VA_ARGS__), #__VA_ARGS__)
 
-TypeID const* test_fn(std::in_place_t) { return (); }
-template 
-TypeID const* test_fn(std::in_place_type_t)
-{ return (); }
-
-template 
-TypeID const* test_fn(std::in_place_index_t)
-{ return (); }
-
-// Concrete test overloads that don't have to be deduced.
-template 
-TypeID const* concrete_test_fn(Tag) {  return (); }
-
-template 
-bool check_tag_basic() {
-  using RawTp = typename std::remove_reference::type;
-  static_assert(std::is_lvalue_reference::value, "");
-  static_assert(std::is_function::value, "");
-  static_assert(CheckRet::value, "");
-  auto concrete_fn = concrete_test_fn;
-  return test_fn((Tp)std::in_place) == ()
-  && concrete_fn(std::in_place) == ();
+template 
+constexpr bool check_tag(Up) {
+return std::is_same::value
+&& std::is_same::value;
 }
 
 int main() {
-// test in_place_tag
-{
-static_assert(!std::is_default_constructible::value, "");
-}
 // test in_place_t
 {
 using T = std::in_place_t;
-assert(check_tag_basic());
-assert(test_fn((T)std::in_place) == ());
+STATIC_ASSERT(check_tag(std::in_place));
 }
 // test in_place_type_t
 {
 using T1 = std::in_place_type_t;
 using T2 = std::in_place_type_t;
 using T3 = std::in_place_type_t;
-assert(check_tag_basic());
-assert(check_tag_basic());
-assert(check_tag_basic());
-static_assert(!std::is_same::value && !std::is_same::value, "");
-static_assert(!std::is_same::value, "");
+STATIC_ASSERT(!std::is_same::value && !std::is_same::value);
+STATIC_ASSERT(!std::is_same::value);
+STATIC_ASSERT(check_tag(std::in_place_type));
+STATIC_ASSERT(check_tag(std::in_place_type));
+STATIC_ASSERT(check_tag(std::in_place_type));
 }
 // test in_place_index_t
 {
 using T1 = std::in_place_index_t<0>;
 using T2 = std::in_place_index_t<1>;
 using T3 = std::in_place_index_t;
-assert(check_tag_basic());
-assert(check_tag_basic());
-assert(check_tag_basic());
-static_assert(!std::is_same::value && !std::is_same::value, "");
-static_assert(!std::is_same::value, "");
+STATIC_ASSERT(!std::is_same::value && !std::is_same::value);
+STATIC_ASSERT(!std::is_same::value);
+STATIC_ASSERT(check_tag(std::in_place_index<0>));
+STATIC_ASSERT(check_tag(std::in_place_index<1>));
+STATIC_ASSERT(check_tag(std::in_place_index));
 }
-}
\ No newline at end of file
+}
Index: test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
===
--- test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
+++ test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
@@ -192,7 +192,6 @@
 

[PATCH] D26782: [libcxx] [test] Test changes for P0504R0 "Revisiting in-place tag types for any/optional/variant"

2016-11-16 Thread Casey Carter via cfe-commits
CaseyCarter created this revision.
CaseyCarter added reviewers: mclow.lists, EricWF.
CaseyCarter added a subscriber: cfe-commits.

Note that this does not implement the product code changes to  and 
, this is only the necessary changes to accompanying test code.


https://reviews.llvm.org/D26782

Files:
  test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp
  test/std/utilities/any/any.class/any.cons/value.pass.cpp
  test/std/utilities/utility/utility.inplace/inplace.pass.cpp

Index: test/std/utilities/utility/utility.inplace/inplace.pass.cpp
===
--- test/std/utilities/utility/utility.inplace/inplace.pass.cpp
+++ test/std/utilities/utility/utility.inplace/inplace.pass.cpp
@@ -11,21 +11,24 @@
 
 // 
 
-// struct in_place_tag { in_place_tag() = delete; };
-//
-// using in_place_t = in_place_tag(&)(unspecified);
+// struct in_place_t {
+//   explicit in_place_t() = default;
+// };
+// inline constexpr in_place_t in_place{};
+
 // template 
-// using in_place_type_t = in_place_tag(&)(unspecified);
-// template 
-// using in_place_index_t = in_place_tag(&)(unspecified);
-//
-// in_place_tag in_place(unspecified);
-//
-// template ;
-// in_place_tag in_place(unspecified);
-//
-// template 
-// in_place_tag in_place(unspecified);
+//   struct in_place_type_t {
+// explicit in_place_type_t() = default;
+//   };
+// template 
+//   inline constexpr in_place_type_t in_place_type{};
+
+// template 
+//   struct in_place_index_t {
+// explicit in_place_index_t() = default;
+//   };
+// template 
+//   inline constexpr in_place_index_t in_place_index{};
 
 #include 
 #include 
@@ -34,66 +37,40 @@
 #include "test_macros.h"
 #include "type_id.h"
 
-template 
-struct CheckRet : std::false_type {};
-template 
-struct CheckRet : std::true_type {};
+#define STATIC_ASSERT(...) static_assert((__VA_ARGS__), #__VA_ARGS__)
 
-TypeID const* test_fn(std::in_place_t) { return (); }
-template 
-TypeID const* test_fn(std::in_place_type_t)
-{ return (); }
-
-template 
-TypeID const* test_fn(std::in_place_index_t)
-{ return (); }
-
-// Concrete test overloads that don't have to be deduced.
-template 
-TypeID const* concrete_test_fn(Tag) {  return (); }
-
-template 
-bool check_tag_basic() {
-  using RawTp = typename std::remove_reference::type;
-  static_assert(std::is_lvalue_reference::value, "");
-  static_assert(std::is_function::value, "");
-  static_assert(CheckRet::value, "");
-  auto concrete_fn = concrete_test_fn;
-  return test_fn((Tp)std::in_place) == ()
-  && concrete_fn(std::in_place) == ();
+template 
+constexpr bool check_tag(Up) {
+return std::is_same::value
+&& std::is_same::value;
 }
 
 int main() {
-// test in_place_tag
-{
-static_assert(!std::is_default_constructible::value, "");
-}
 // test in_place_t
 {
 using T = std::in_place_t;
-assert(check_tag_basic());
-assert(test_fn((T)std::in_place) == ());
+STATIC_ASSERT(check_tag(std::in_place));
 }
 // test in_place_type_t
 {
 using T1 = std::in_place_type_t;
 using T2 = std::in_place_type_t;
 using T3 = std::in_place_type_t;
-assert(check_tag_basic());
-assert(check_tag_basic());
-assert(check_tag_basic());
-static_assert(!std::is_same::value && !std::is_same::value, "");
-static_assert(!std::is_same::value, "");
+STATIC_ASSERT(!std::is_same::value && !std::is_same::value);
+STATIC_ASSERT(!std::is_same::value);
+STATIC_ASSERT(check_tag(std::in_place_type));
+STATIC_ASSERT(check_tag(std::in_place_type));
+STATIC_ASSERT(check_tag(std::in_place_type));
 }
 // test in_place_index_t
 {
 using T1 = std::in_place_index_t<0>;
 using T2 = std::in_place_index_t<1>;
 using T3 = std::in_place_index_t;
-assert(check_tag_basic());
-assert(check_tag_basic());
-assert(check_tag_basic());
-static_assert(!std::is_same::value && !std::is_same::value, "");
-static_assert(!std::is_same::value, "");
+STATIC_ASSERT(!std::is_same::value && !std::is_same::value);
+STATIC_ASSERT(!std::is_same::value);
+STATIC_ASSERT(check_tag(std::in_place_index<0>));
+STATIC_ASSERT(check_tag(std::in_place_index<1>));
+STATIC_ASSERT(check_tag(std::in_place_index));
 }
-}
\ No newline at end of file
+}
Index: test/std/utilities/any/any.class/any.cons/value.pass.cpp
===
--- test/std/utilities/any/any.class/any.cons/value.pass.cpp
+++ test/std/utilities/any/any.class/any.cons/value.pass.cpp
@@ -106,13 +106,12 @@
 }
 }
 
-// Test 

[PATCH] D26007: [libc++] Cleanup non-portable std::any tests

2016-10-26 Thread Casey Carter via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285234: Cleanup nonportable behavior in tests for std::any 
(authored by CaseyCarter).

Changed prior to commit:
  https://reviews.llvm.org/D26007?vs=75936=75938#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26007

Files:
  libcxx/trunk/test/std/utilities/any/any.class/any.cons/move.pass.cpp
  libcxx/trunk/test/std/utilities/any/any.class/any.cons/value.pass.cpp
  libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp


Index: libcxx/trunk/test/std/utilities/any/any.class/any.cons/value.pass.cpp
===
--- libcxx/trunk/test/std/utilities/any/any.class/any.cons/value.pass.cpp
+++ libcxx/trunk/test/std/utilities/any/any.class/any.cons/value.pass.cpp
@@ -137,10 +137,6 @@
 static_assert(!std::is_constructible::value, "");
 }
 {
-using DecayTag = std::decay_t;
-static_assert(!std::is_constructible::value, "");
-}
-{
 // Test that the ValueType&& constructor SFINAE's away when the
 // argument is non-copyable
 struct NoCopy {
Index: libcxx/trunk/test/std/utilities/any/any.class/any.cons/move.pass.cpp
===
--- libcxx/trunk/test/std/utilities/any/any.class/any.cons/move.pass.cpp
+++ libcxx/trunk/test/std/utilities/any/any.class/any.cons/move.pass.cpp
@@ -80,8 +80,8 @@
 assert(Type::moved == 1 || Type::moved == 2); // zero or more move 
operations can be performed.
 assert(Type::copied == 0); // no copies can be performed.
 assert(Type::count == 1 + a.has_value());
-assertEmpty(a); // Moves are always destructive.
 assertContains(a2, 42);
+LIBCPP_ASSERT(!a.has_value()); // Moves are always destructive.
 if (a.has_value())
 assertContains(a, 0);
 }
Index: libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
===
--- libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
+++ libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
@@ -104,18 +104,18 @@
 assertContains(a, 42);
 assert(T::count == 1);
 assert(T::copied == 0);
-assert(T::moved == 0);
+LIBCPP_ASSERT(T::moved == 0);
 }
 assert(small::count == 0);
 { // large
 using T = large;
 any a{T{42}};
 T::reset();
 a.swap(a);
 assertContains(a, 42);
-assert(T::copied == 0);
-assert(T::moved == 0);
 assert(T::count == 1);
+assert(T::copied == 0);
+LIBCPP_ASSERT(T::moved == 0);
 }
 assert(large::count == 0);
 }


Index: libcxx/trunk/test/std/utilities/any/any.class/any.cons/value.pass.cpp
===
--- libcxx/trunk/test/std/utilities/any/any.class/any.cons/value.pass.cpp
+++ libcxx/trunk/test/std/utilities/any/any.class/any.cons/value.pass.cpp
@@ -137,10 +137,6 @@
 static_assert(!std::is_constructible::value, "");
 }
 {
-using DecayTag = std::decay_t;
-static_assert(!std::is_constructible::value, "");
-}
-{
 // Test that the ValueType&& constructor SFINAE's away when the
 // argument is non-copyable
 struct NoCopy {
Index: libcxx/trunk/test/std/utilities/any/any.class/any.cons/move.pass.cpp
===
--- libcxx/trunk/test/std/utilities/any/any.class/any.cons/move.pass.cpp
+++ libcxx/trunk/test/std/utilities/any/any.class/any.cons/move.pass.cpp
@@ -80,8 +80,8 @@
 assert(Type::moved == 1 || Type::moved == 2); // zero or more move operations can be performed.
 assert(Type::copied == 0); // no copies can be performed.
 assert(Type::count == 1 + a.has_value());
-assertEmpty(a); // Moves are always destructive.
 assertContains(a2, 42);
+LIBCPP_ASSERT(!a.has_value()); // Moves are always destructive.
 if (a.has_value())
 assertContains(a, 0);
 }
Index: libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
===
--- libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
+++ libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
@@ -104,18 +104,18 @@
 assertContains(a, 42);
 assert(T::count == 1);
 assert(T::copied == 0);
-assert(T::moved == 0);
+LIBCPP_ASSERT(T::moved == 0);
 }
 assert(small::count == 0);
 { // large
 using T = large;
 any a{T{42}};
 T::reset();
 a.swap(a);
 assertContains(a, 42);
-assert(T::copied == 

[libcxx] r285234 - Cleanup nonportable behavior in tests for std::any

2016-10-26 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Wed Oct 26 15:18:13 2016
New Revision: 285234

URL: http://llvm.org/viewvc/llvm-project?rev=285234=rev
Log:
Cleanup nonportable behavior in tests for std::any

Fixes MS issues 63, 64, and 65.

test/std/utilities/any/any.class/any.cons/move.pass.cpp:
* "Moves are always destructive" is not a portable assumption; check with 
LIBCPP_ASSERT.

test/std/utilities/any/any.class/any.cons/value.pass.cpp:
* The standard does not forbid initializing std::any from any 
pointer-to-function type. Remove the non-conforming "DecayTag" test.

test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp:
* Self-swap is not specified to perform no moves; check with LIBCPP_ASSERT.

Differential Revision: https://reviews.llvm.org/D26007


Modified:
libcxx/trunk/test/std/utilities/any/any.class/any.cons/move.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.cons/value.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp

Modified: libcxx/trunk/test/std/utilities/any/any.class/any.cons/move.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/any/any.class/any.cons/move.pass.cpp?rev=285234=285233=285234=diff
==
--- libcxx/trunk/test/std/utilities/any/any.class/any.cons/move.pass.cpp 
(original)
+++ libcxx/trunk/test/std/utilities/any/any.class/any.cons/move.pass.cpp Wed 
Oct 26 15:18:13 2016
@@ -80,8 +80,8 @@ void test_move() {
 assert(Type::moved == 1 || Type::moved == 2); // zero or more move 
operations can be performed.
 assert(Type::copied == 0); // no copies can be performed.
 assert(Type::count == 1 + a.has_value());
-assertEmpty(a); // Moves are always destructive.
 assertContains(a2, 42);
+LIBCPP_ASSERT(!a.has_value()); // Moves are always destructive.
 if (a.has_value())
 assertContains(a, 0);
 }

Modified: libcxx/trunk/test/std/utilities/any/any.class/any.cons/value.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/any/any.class/any.cons/value.pass.cpp?rev=285234=285233=285234=diff
==
--- libcxx/trunk/test/std/utilities/any/any.class/any.cons/value.pass.cpp 
(original)
+++ libcxx/trunk/test/std/utilities/any/any.class/any.cons/value.pass.cpp Wed 
Oct 26 15:18:13 2016
@@ -137,10 +137,6 @@ void test_sfinae_constraints() {
 static_assert(!std::is_constructible::value, "");
 }
 {
-using DecayTag = std::decay_t;
-static_assert(!std::is_constructible::value, "");
-}
-{
 // Test that the ValueType&& constructor SFINAE's away when the
 // argument is non-copyable
 struct NoCopy {

Modified: 
libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp?rev=285234=285233=285234=diff
==
--- libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp 
(original)
+++ libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp 
Wed Oct 26 15:18:13 2016
@@ -104,7 +104,7 @@ void test_self_swap() {
 assertContains(a, 42);
 assert(T::count == 1);
 assert(T::copied == 0);
-assert(T::moved == 0);
+LIBCPP_ASSERT(T::moved == 0);
 }
 assert(small::count == 0);
 { // large
@@ -113,9 +113,9 @@ void test_self_swap() {
 T::reset();
 a.swap(a);
 assertContains(a, 42);
-assert(T::copied == 0);
-assert(T::moved == 0);
 assert(T::count == 1);
+assert(T::copied == 0);
+LIBCPP_ASSERT(T::moved == 0);
 }
 assert(large::count == 0);
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26007: [libc++] Cleanup non-portable std::any tests

2016-10-26 Thread Casey Carter via cfe-commits
CaseyCarter marked 2 inline comments as done.
CaseyCarter added a comment.

DecayTag destroyed.


https://reviews.llvm.org/D26007



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26007: [libc++] Cleanup non-portable std::any tests

2016-10-26 Thread Casey Carter via cfe-commits
CaseyCarter removed rL LLVM as the repository for this revision.
CaseyCarter updated this revision to Diff 75936.
CaseyCarter added a comment.

Cleanup nonportable behavior in tests for `std::any`

Fixes MS issues 63, 64, and 65.

test/std/utilities/any/any.class/any.cons/move.pass.cpp:

- "Moves are always destructive" is not a portable assumption; check with 
`LIBCPP_ASSERT`.

test/std/utilities/any/any.class/any.cons/value.pass.cpp:

- The standard does not forbid initializing `std::any` from any 
pointer-to-function type. Remove the non-conforming `DecayTag` test.

test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp:

- Self-swap is not specified to perform no moves; check with `LIBCPP_ASSERT`.


https://reviews.llvm.org/D26007

Files:
  test/std/utilities/any/any.class/any.cons/move.pass.cpp
  test/std/utilities/any/any.class/any.cons/value.pass.cpp
  test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp


Index: test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
===
--- test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
+++ test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
@@ -104,7 +104,7 @@
 assertContains(a, 42);
 assert(T::count == 1);
 assert(T::copied == 0);
-assert(T::moved == 0);
+LIBCPP_ASSERT(T::moved == 0);
 }
 assert(small::count == 0);
 { // large
@@ -113,9 +113,9 @@
 T::reset();
 a.swap(a);
 assertContains(a, 42);
-assert(T::copied == 0);
-assert(T::moved == 0);
 assert(T::count == 1);
+assert(T::copied == 0);
+LIBCPP_ASSERT(T::moved == 0);
 }
 assert(large::count == 0);
 }
Index: test/std/utilities/any/any.class/any.cons/value.pass.cpp
===
--- test/std/utilities/any/any.class/any.cons/value.pass.cpp
+++ test/std/utilities/any/any.class/any.cons/value.pass.cpp
@@ -137,10 +137,6 @@
 static_assert(!std::is_constructible::value, "");
 }
 {
-using DecayTag = std::decay_t;
-static_assert(!std::is_constructible::value, "");
-}
-{
 // Test that the ValueType&& constructor SFINAE's away when the
 // argument is non-copyable
 struct NoCopy {
Index: test/std/utilities/any/any.class/any.cons/move.pass.cpp
===
--- test/std/utilities/any/any.class/any.cons/move.pass.cpp
+++ test/std/utilities/any/any.class/any.cons/move.pass.cpp
@@ -80,8 +80,8 @@
 assert(Type::moved == 1 || Type::moved == 2); // zero or more move 
operations can be performed.
 assert(Type::copied == 0); // no copies can be performed.
 assert(Type::count == 1 + a.has_value());
-assertEmpty(a); // Moves are always destructive.
 assertContains(a2, 42);
+LIBCPP_ASSERT(!a.has_value()); // Moves are always destructive.
 if (a.has_value())
 assertContains(a, 0);
 }


Index: test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
===
--- test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
+++ test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
@@ -104,7 +104,7 @@
 assertContains(a, 42);
 assert(T::count == 1);
 assert(T::copied == 0);
-assert(T::moved == 0);
+LIBCPP_ASSERT(T::moved == 0);
 }
 assert(small::count == 0);
 { // large
@@ -113,9 +113,9 @@
 T::reset();
 a.swap(a);
 assertContains(a, 42);
-assert(T::copied == 0);
-assert(T::moved == 0);
 assert(T::count == 1);
+assert(T::copied == 0);
+LIBCPP_ASSERT(T::moved == 0);
 }
 assert(large::count == 0);
 }
Index: test/std/utilities/any/any.class/any.cons/value.pass.cpp
===
--- test/std/utilities/any/any.class/any.cons/value.pass.cpp
+++ test/std/utilities/any/any.class/any.cons/value.pass.cpp
@@ -137,10 +137,6 @@
 static_assert(!std::is_constructible::value, "");
 }
 {
-using DecayTag = std::decay_t;
-static_assert(!std::is_constructible::value, "");
-}
-{
 // Test that the ValueType&& constructor SFINAE's away when the
 // argument is non-copyable
 struct NoCopy {
Index: test/std/utilities/any/any.class/any.cons/move.pass.cpp
===
--- test/std/utilities/any/any.class/any.cons/move.pass.cpp
+++ test/std/utilities/any/any.class/any.cons/move.pass.cpp
@@ -80,8 +80,8 @@
 assert(Type::moved == 1 || Type::moved == 2); // zero or more move operations can be performed.
 assert(Type::copied == 0); // no copies can be performed.

[PATCH] D26007: [libc++] Cleanup non-portable std::any tests

2016-10-26 Thread Casey Carter via cfe-commits
CaseyCarter added inline comments.



Comment at: test/libcxx/utilities/any/any.class/any.cons/value.pass.cpp:36
+using DecayTag = std::decay_t;
+static_assert(!std::is_constructible::value, "");
+}

I'm generously calling this a "libc++ extension." From my interpretation of 
N4606, LWG2744, and LWG2754, this appears to be a bug.


Repository:
  rL LLVM

https://reviews.llvm.org/D26007



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26007: [libc++] Cleanup non-portable std::any tests

2016-10-26 Thread Casey Carter via cfe-commits
CaseyCarter created this revision.
CaseyCarter added reviewers: EricWF, mclow.lists.
CaseyCarter added a subscriber: cfe-commits.
CaseyCarter set the repository for this revision to rL LLVM.

Cleanup nonportable behavior in tests for `std::any`

Fixes MS issues 63, 64, and 65.

test/std/utilities/any/any.class/any.cons/move.pass.cpp:

- "Moves are always destructive" is not a portable assumption; check with 
`LIBCPP_ASSERT`.

test/std/utilities/any/any.class/any.cons/value.pass.cpp:
test/libcxx/utilities/any/any.class/any.cons/value.pass.cpp:

- The standard does not forbid initializing `std::any` from any 
pointer-to-function type. The `DecayTag` test is a libc++ extension (at best); 
factor it out into a test in the libcxx hierarchy.

test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp:

- Self-swap is not specified to perform no moves; check with `LIBCPP_ASSERT`.


Repository:
  rL LLVM

https://reviews.llvm.org/D26007

Files:
  test/libcxx/utilities/any/any.class/any.cons/value.pass.cpp
  test/std/utilities/any/any.class/any.cons/move.pass.cpp
  test/std/utilities/any/any.class/any.cons/value.pass.cpp
  test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp


Index: test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
===
--- test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
+++ test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
@@ -104,7 +104,7 @@
 assertContains(a, 42);
 assert(T::count == 1);
 assert(T::copied == 0);
-assert(T::moved == 0);
+LIBCPP_ASSERT(T::moved == 0);
 }
 assert(small::count == 0);
 { // large
@@ -113,9 +113,9 @@
 T::reset();
 a.swap(a);
 assertContains(a, 42);
-assert(T::copied == 0);
-assert(T::moved == 0);
 assert(T::count == 1);
+assert(T::copied == 0);
+LIBCPP_ASSERT(T::moved == 0);
 }
 assert(large::count == 0);
 }
Index: test/std/utilities/any/any.class/any.cons/value.pass.cpp
===
--- test/std/utilities/any/any.class/any.cons/value.pass.cpp
+++ test/std/utilities/any/any.class/any.cons/value.pass.cpp
@@ -137,10 +137,6 @@
 static_assert(!std::is_constructible::value, "");
 }
 {
-using DecayTag = std::decay_t;
-static_assert(!std::is_constructible::value, "");
-}
-{
 // Test that the ValueType&& constructor SFINAE's away when the
 // argument is non-copyable
 struct NoCopy {
Index: test/std/utilities/any/any.class/any.cons/move.pass.cpp
===
--- test/std/utilities/any/any.class/any.cons/move.pass.cpp
+++ test/std/utilities/any/any.class/any.cons/move.pass.cpp
@@ -80,8 +80,8 @@
 assert(Type::moved == 1 || Type::moved == 2); // zero or more move 
operations can be performed.
 assert(Type::copied == 0); // no copies can be performed.
 assert(Type::count == 1 + a.has_value());
-assertEmpty(a); // Moves are always destructive.
 assertContains(a2, 42);
+LIBCPP_ASSERT(!a.has_value()); // Moves are always destructive.
 if (a.has_value())
 assertContains(a, 0);
 }
Index: test/libcxx/utilities/any/any.class/any.cons/value.pass.cpp
===
--- /dev/null
+++ test/libcxx/utilities/any/any.class/any.cons/value.pass.cpp
@@ -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.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// 
+
+// template  any(Value &&)
+
+// Test construction from a value.
+// Concerns:
+// -
+// 1. The value is properly move/copied depending on the value category.
+// 2. Both small and large values are properly handled.
+
+
+#include 
+#include 
+
+#include "test_macros.h"
+
+using std::any;
+using std::any_cast;
+
+int main() {
+// Test that any(ValueType&&) is *never* selected for a std::in_place type.
+// Test that the tag type is properly handled in SFINAE
+using BadTag = std::in_place_type_t;
+using DecayTag = std::decay_t;
+static_assert(!std::is_constructible::value, "");
+}


Index: test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
===
--- test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
+++ test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
@@ -104,7 +104,7 @@
 assertContains(a, 42);
 assert(T::count == 

[PATCH] D25958: [libc++] Silence "unused parameter" warnings in test/support/archetypes.hpp

2016-10-26 Thread Casey Carter via cfe-commits
CaseyCarter closed this revision.
CaseyCarter added a comment.

Committed as r285213.


https://reviews.llvm.org/D25958



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r285213 - Silence unused parameter warnings in archetypes.hpp

2016-10-26 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Wed Oct 26 12:22:25 2016
New Revision: 285213

URL: http://llvm.org/viewvc/llvm-project?rev=285213=rev
Log:
Silence unused parameter warnings in archetypes.hpp
Reviewed at: https://reviews.llvm.org/D25958


Modified:
libcxx/trunk/test/support/archetypes.hpp

Modified: libcxx/trunk/test/support/archetypes.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/archetypes.hpp?rev=285213=285212=285213=diff
==
--- libcxx/trunk/test/support/archetypes.hpp (original)
+++ libcxx/trunk/test/support/archetypes.hpp Wed Oct 26 12:22:25 2016
@@ -68,12 +68,12 @@ struct TestBase {
 ++alive; ++constructed; ++value_constructed;
 }
 template ::type = true>
-explicit TestBase(std::initializer_list& il, int y = 0) noexcept
+explicit TestBase(std::initializer_list& il, int = 0) noexcept
   : value(il.size()) {
 ++alive; ++constructed; ++value_constructed;
 }
 template ::type = true>
-explicit TestBase(std::initializer_list& il, int y = 0) noexcept : 
value(il.size()) {
+explicit TestBase(std::initializer_list& il, int = 0) noexcept : 
value(il.size()) {
 ++alive; ++constructed; ++value_constructed;
 }
 TestBase& operator=(int xvalue) noexcept {
@@ -135,9 +135,9 @@ struct ValueBase {
 template ::type = true>
 constexpr ValueBase(int, int y) : value(y) {}
 template ::type = true>
-explicit constexpr ValueBase(std::initializer_list& il, int y = 0) : 
value(il.size()) {}
+explicit constexpr ValueBase(std::initializer_list& il, int = 0) : 
value(il.size()) {}
 template ::type = true>
-constexpr ValueBase(std::initializer_list& il, int y = 0) : 
value(il.size()) {}
+constexpr ValueBase(std::initializer_list& il, int = 0) : 
value(il.size()) {}
 TEST_CONSTEXPR_CXX14 ValueBase& operator=(int xvalue) noexcept {
 value = xvalue;
 return *this;
@@ -193,9 +193,9 @@ struct TrivialValueBase {
 template ::type = true>
 constexpr TrivialValueBase(int, int y) : value(y) {}
 template ::type = true>
-explicit constexpr TrivialValueBase(std::initializer_list& il, int y 
= 0) : value(il.size()) {}
+explicit constexpr TrivialValueBase(std::initializer_list& il, int = 
0) : value(il.size()) {}
 template ::type = true>
-constexpr TrivialValueBase(std::initializer_list& il, int y = 0) : 
value(il.size()) {};
+constexpr TrivialValueBase(std::initializer_list& il, int = 0) : 
value(il.size()) {};
 int value;
 protected:
 constexpr TrivialValueBase() noexcept : value(0) {}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25958: [libc++] Silence "unused parameter" warnings in test/support/archetypes.hpp

2016-10-25 Thread Casey Carter via cfe-commits
CaseyCarter created this revision.
CaseyCarter added reviewers: EricWF, mclow.lists.
CaseyCarter added a subscriber: cfe-commits.

Fairly straightforward: simply removes the parameter names from the unused 
parameters.


https://reviews.llvm.org/D25958

Files:
  test/support/archetypes.hpp


Index: test/support/archetypes.hpp
===
--- test/support/archetypes.hpp
+++ test/support/archetypes.hpp
@@ -68,12 +68,12 @@
 ++alive; ++constructed; ++value_constructed;
 }
 template ::type = true>
-explicit TestBase(std::initializer_list& il, int y = 0) noexcept
+explicit TestBase(std::initializer_list& il, int = 0) noexcept
   : value(il.size()) {
 ++alive; ++constructed; ++value_constructed;
 }
 template ::type = true>
-explicit TestBase(std::initializer_list& il, int y = 0) noexcept : 
value(il.size()) {
+explicit TestBase(std::initializer_list& il, int = 0) noexcept : 
value(il.size()) {
 ++alive; ++constructed; ++value_constructed;
 }
 TestBase& operator=(int xvalue) noexcept {
@@ -135,9 +135,9 @@
 template ::type = true>
 constexpr ValueBase(int, int y) : value(y) {}
 template ::type = true>
-explicit constexpr ValueBase(std::initializer_list& il, int y = 0) : 
value(il.size()) {}
+explicit constexpr ValueBase(std::initializer_list& il, int = 0) : 
value(il.size()) {}
 template ::type = true>
-constexpr ValueBase(std::initializer_list& il, int y = 0) : 
value(il.size()) {}
+constexpr ValueBase(std::initializer_list& il, int = 0) : 
value(il.size()) {}
 TEST_CONSTEXPR_CXX14 ValueBase& operator=(int xvalue) noexcept {
 value = xvalue;
 return *this;
@@ -193,9 +193,9 @@
 template ::type = true>
 constexpr TrivialValueBase(int, int y) : value(y) {}
 template ::type = true>
-explicit constexpr TrivialValueBase(std::initializer_list& il, int y 
= 0) : value(il.size()) {}
+explicit constexpr TrivialValueBase(std::initializer_list& il, int = 
0) : value(il.size()) {}
 template ::type = true>
-constexpr TrivialValueBase(std::initializer_list& il, int y = 0) : 
value(il.size()) {};
+constexpr TrivialValueBase(std::initializer_list& il, int = 0) : 
value(il.size()) {};
 int value;
 protected:
 constexpr TrivialValueBase() noexcept : value(0) {}


Index: test/support/archetypes.hpp
===
--- test/support/archetypes.hpp
+++ test/support/archetypes.hpp
@@ -68,12 +68,12 @@
 ++alive; ++constructed; ++value_constructed;
 }
 template ::type = true>
-explicit TestBase(std::initializer_list& il, int y = 0) noexcept
+explicit TestBase(std::initializer_list& il, int = 0) noexcept
   : value(il.size()) {
 ++alive; ++constructed; ++value_constructed;
 }
 template ::type = true>
-explicit TestBase(std::initializer_list& il, int y = 0) noexcept : value(il.size()) {
+explicit TestBase(std::initializer_list& il, int = 0) noexcept : value(il.size()) {
 ++alive; ++constructed; ++value_constructed;
 }
 TestBase& operator=(int xvalue) noexcept {
@@ -135,9 +135,9 @@
 template ::type = true>
 constexpr ValueBase(int, int y) : value(y) {}
 template ::type = true>
-explicit constexpr ValueBase(std::initializer_list& il, int y = 0) : value(il.size()) {}
+explicit constexpr ValueBase(std::initializer_list& il, int = 0) : value(il.size()) {}
 template ::type = true>
-constexpr ValueBase(std::initializer_list& il, int y = 0) : value(il.size()) {}
+constexpr ValueBase(std::initializer_list& il, int = 0) : value(il.size()) {}
 TEST_CONSTEXPR_CXX14 ValueBase& operator=(int xvalue) noexcept {
 value = xvalue;
 return *this;
@@ -193,9 +193,9 @@
 template ::type = true>
 constexpr TrivialValueBase(int, int y) : value(y) {}
 template ::type = true>
-explicit constexpr TrivialValueBase(std::initializer_list& il, int y = 0) : value(il.size()) {}
+explicit constexpr TrivialValueBase(std::initializer_list& il, int = 0) : value(il.size()) {}
 template ::type = true>
-constexpr TrivialValueBase(std::initializer_list& il, int y = 0) : value(il.size()) {};
+constexpr TrivialValueBase(std::initializer_list& il, int = 0) : value(il.size()) {};
 int value;
 protected:
 constexpr TrivialValueBase() noexcept : value(0) {}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25249: [libc++] Many any test fixes

2016-10-10 Thread Casey Carter via cfe-commits
CaseyCarter abandoned this revision.
CaseyCarter added a comment.

Ignoring the assignment from in_place_t issue for now, r283606 is good modulo a 
couple of tiny things that I'll just email you directly.


https://reviews.llvm.org/D25249



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25249: [libc++] Many any test fixes

2016-10-04 Thread Casey Carter via cfe-commits
CaseyCarter added a comment.

I'll push a revision with the whitespace changes reverted soon.



> .gitignore:59
>  keep.lst
> +.vscode/

This is an editor byproduct, I suppose, not "MSVC libraries test harness". Let 
me know if anyone cares and I'll add a comment.

> any:553
> +__tmp.__call(_Action::_Move, this);
> +}
>  }

Don't blow up on self swap. This is the obvious (naive) fix; it's possible that 
someone who has looked at more of the implementation than this single function 
could devise a better fix.

> value.pass.cpp:25
> +// Test that any& operator=(ValueType&&) is *never* selected for:
> +// * std::in_place type.
> +{

This behavior is not required by N4606, so I moved this test to the libcxx tree.

> value.pass.cpp:23
> +int main() {
> +// test construction from INSANE copy-but-not-movable types.
> +using Type = deleted_move;

Again, not required behavior (I am, of course, totally unbiased about whether 
this behavior is a good idea.)

> any_cast_reference.pass.cpp:34
> +
> +// Test that I can retrieve INSANE copy-but-not-movable type from an any
> +void test_cast_to_value_deleted_move()

ibid.

> move.pass.cpp:43
>  assert(LHS::count == 1);
> -assert(RHS::count == 2);
> +assert(RHS::count == 2 + a2.has_value());
>  

Portability fix: don't rely on a moved-from `any` being empty. (Occurs more 
below)

> move.pass.cpp:93
> +, "any & operator=(any &&) must be noexcept"
> +);
>  }

Woops - I forgot to review the diff without -w. Will correct this unintended 
whitespace change.

> value.pass.cpp:69
>  assert(LHS::count == 0);
> -assert(RHS::count == 1);
> +assert(RHS::count == 1 + rhs.has_value());
>  

Again, don't rely on `any`'s moved-from state being empty.

> value.pass.cpp:123
>  Move ? lhs = std::move(rhs)
> - : lhs = rhs;
> +: lhs = rhs;
>  assert(false);

Whitespace again (will fix).

> value.pass.cpp:172
>  void test_sfinae_constraints() {
> -{
> -using Tag = std::in_place_type_t;

I split out these non-portable tests into 
test/libcxx/utilities/any.class/any.assign/value.pass.cpp

> copy.pass.cpp:74
>  assertContains(a, 42);
> -assertContains(a, 42);
> +assertContains(a2, 42);
>  

Typo in the original test.

> move.pass.cpp:80
>  
> -assert(Type::moved >= 1); // zero or more move operations can be 
> performed.
> +assert(Type::moved == 1 || Type::moved == 2); // zero or one move 
> operations can be performed.
>  assert(Type::copied == 0); // no copies can be performed.

More move behavior.

> move.pass.cpp:97
> +, "any must be nothrow move constructible"
> +);
>  }

Another inadvertent whitespace change.

> value.pass.cpp:110
>  
> -void test_non_moveable_type()
> -{

Non-portable behavior split into 
test/libcxx/utilities/any.class/any.cons/value.pass.cpp

> value.pass.cpp:143
> +NoCopy(NoCopy const&) = delete;
> +NoCopy(int) {}
>  };

Inadvertent whitespace change.

> value.pass.cpp:182
>  test_move_value_throws();
> -test_non_moveable_type();
>  test_sfinae_constraints();

See above.

> emplace.pass.cpp:132
>LargeThrows(std::initializer_list, int) { throw 42; }
> -  int data[10];
> +  int data[sizeof(std::any)];
>  };

Ensure that `LargeThrows` is large, regardless of how bloated `std::any` may 
become.

> emplace.pass.cpp:234
> +NoCopy(int) {}
> +NoCopy(std::initializer_list, int, int) {}
>  };

Inadvertent whitespace change.

> swap.pass.cpp:89
> +, "any::swap(any&) must be noexcept"
> +);
> +}

ibid.

> swap.pass.cpp:92
> +
> +void test_self_swap()
> +{

New test: self-`swap` must have no effect.

> any_cast_reference.pass.cpp:71
>  
> -template 
> -void checkThrows(any& a)
> +template 
> +void checkThrowsRvalue(any&, std::true_type)

Possibly controversial: I'm going to propose that `template 
any_cast(any&&)` should require that `T` is not an lvalue reference type, so 
that it cannot return potentially dangling references. That means the portion 
of this test that performs `any_cast(any&&)` must be conditioned on whether 
or not `T` is an lvalue reference type.

> any_cast_reference.pass.cpp:146
> -// Check getting a type by reference from a non-const rvalue
> -{
> -Type& v = any_cast(std::move(a));

This code becomes ill-formed with the above proposed change.

> any_cast_reference.pass.cpp:198
>  any a((Type(42)));
> -any const& ca = a;
>  assert(Type::count == 1);

Remove unused variable `ca`.

> any_cast_reference.pass.cpp:306
>  
> -void test_cast_to_value_deleted_move()
> -{

Non-standard behavior split out into 
test/libcxx/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp

> make_any.pass.cpp:102
>LargeThrows(std::initializer_list, int) { throw 42; }
> -  int data[10];
> +  int 

[PATCH] D25249: [libc++] Many any test fixes

2016-10-04 Thread Casey Carter via cfe-commits
CaseyCarter updated this revision to Diff 73538.
CaseyCarter added a comment.

Fix inadvertent whitespace changes.


https://reviews.llvm.org/D25249

Files:
  .gitignore
  include/any
  test/libcxx/utilities/any/any.class/any.assign/value.pass.cpp
  test/libcxx/utilities/any/any.class/any.cons/value.pass.cpp
  test/libcxx/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
  test/std/utilities/any/any.class/any.assign/move.pass.cpp
  test/std/utilities/any/any.class/any.assign/value.pass.cpp
  test/std/utilities/any/any.class/any.cons/copy.pass.cpp
  test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp
  test/std/utilities/any/any.class/any.cons/move.pass.cpp
  test/std/utilities/any/any.class/any.cons/value.pass.cpp
  test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp
  test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
  test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
  test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
  test/std/utilities/any/any.nonmembers/make_any.pass.cpp

Index: test/std/utilities/any/any.nonmembers/make_any.pass.cpp
===
--- test/std/utilities/any/any.nonmembers/make_any.pass.cpp
+++ test/std/utilities/any/any.nonmembers/make_any.pass.cpp
@@ -99,7 +99,7 @@
 struct LargeThrows {
   LargeThrows(int) { throw 42; }
   LargeThrows(std::initializer_list, int) { throw 42; }
-  int data[10];
+  int data[sizeof(std::any)];
 };
 static_assert(!IsSmallObject::value, "");
 
@@ -135,6 +135,5 @@
 #ifndef TEST_HAS_NO_EXCEPTIONS
 test_make_any_throws();
 test_make_any_throws();
-
 #endif
-}
\ No newline at end of file
+}
Index: test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
===
--- test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
+++ test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
@@ -42,4 +42,4 @@
 any_cast(static_cast(a)); // expected-note {{requested here}}
 // expected-error@any:* 3 {{static_assert failed "_ValueType is required to be a reference or a CopyConstructible type."}}
 // expected-error@any:* 2 {{calling a private constructor of class 'no_copy'}}
-}
\ No newline at end of file
+}
Index: test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
===
--- test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
+++ test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
@@ -68,21 +68,29 @@
 static_assert(std::is_same::value, "");
 }
 
-template 
-void checkThrows(any& a)
+template 
+void checkThrowsRvalue(any&, std::true_type)
+{}
+
+template 
+void checkThrowsRvalue(any& a, std::false_type)
 {
-#if !defined(TEST_HAS_NO_EXCEPTIONS)
 try {
-any_cast(a);
+any_cast(static_cast(a));
 assert(false);
 } catch (bad_any_cast const &) {
 // do nothing
 } catch (...) {
 assert(false);
 }
+}
 
+template 
+void checkThrows(any& a)
+{
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
 try {
-any_cast(static_cast(a));
+any_cast(a);
 assert(false);
 } catch (bad_any_cast const &) {
 // do nothing
@@ -91,13 +99,15 @@
 }
 
 try {
-any_cast(static_cast(a));
+any_cast(static_cast(a));
 assert(false);
 } catch (bad_any_cast const &) {
 // do nothing
 } catch (...) {
 assert(false);
 }
+
+checkThrowsRvalue(a, std::is_lvalue_reference{});
 #endif
 }
 
@@ -142,23 +152,7 @@
 Type const  = any_cast(ca);
 assert( == );
 }
-// Check getting a type by reference from a non-const rvalue
-{
-Type& v = any_cast(std::move(a));
-assert(v.value == 42);
-
-Type const  = any_cast(std::move(a));
-assert( == );
-}
-// Check getting a type by reference from a const rvalue any.
-{
-Type const& v = any_cast(std::move(ca));
-assert(v.value == 42);
-
-Type const  = any_cast(std::move(ca));
-assert( == );
-}
-// Check getting a type by reference from a const rvalue any.
+// Check getting a type by rvalue reference from a non-const rvalue any.
 {
 Type&& v = any_cast(std::move(a));
 assert(v.value == 42);
@@ -168,7 +162,7 @@
 assert( == );
 assert(any_cast(a).value == 42);
 }
-// Check getting a type by reference from a const rvalue any.
+// Check getting a type by rvalue reference from a const rvalue any.
 {
 Type const&& v = any_cast(std::move(a));
 

[PATCH] D25249: [libc++] Many any test fixes

2016-10-04 Thread Casey Carter via cfe-commits
CaseyCarter created this revision.
CaseyCarter added reviewers: EricWF, mclow.lists.
CaseyCarter added a subscriber: cfe-commits.

Changes to non-portable behavior in  tests. Inline detailed description of 
each change is forthcoming. Changes are almost entirely in test code, with one 
behavioral change to  itself to fix self-swap behavior.


https://reviews.llvm.org/D25249

Files:
  .gitignore
  include/any
  test/libcxx/utilities/any/any.class/any.assign/value.pass.cpp
  test/libcxx/utilities/any/any.class/any.cons/value.pass.cpp
  test/libcxx/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
  test/std/utilities/any/any.class/any.assign/move.pass.cpp
  test/std/utilities/any/any.class/any.assign/value.pass.cpp
  test/std/utilities/any/any.class/any.cons/copy.pass.cpp
  test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp
  test/std/utilities/any/any.class/any.cons/move.pass.cpp
  test/std/utilities/any/any.class/any.cons/value.pass.cpp
  test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp
  test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
  test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
  test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
  test/std/utilities/any/any.nonmembers/make_any.pass.cpp

Index: test/std/utilities/any/any.nonmembers/make_any.pass.cpp
===
--- test/std/utilities/any/any.nonmembers/make_any.pass.cpp
+++ test/std/utilities/any/any.nonmembers/make_any.pass.cpp
@@ -99,7 +99,7 @@
 struct LargeThrows {
   LargeThrows(int) { throw 42; }
   LargeThrows(std::initializer_list, int) { throw 42; }
-  int data[10];
+  int data[sizeof(std::any)];
 };
 static_assert(!IsSmallObject::value, "");
 
@@ -135,6 +135,5 @@
 #ifndef TEST_HAS_NO_EXCEPTIONS
 test_make_any_throws();
 test_make_any_throws();
-
 #endif
-}
\ No newline at end of file
+}
Index: test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
===
--- test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
+++ test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
@@ -42,4 +42,4 @@
 any_cast(static_cast(a)); // expected-note {{requested here}}
 // expected-error@any:* 3 {{static_assert failed "_ValueType is required to be a reference or a CopyConstructible type."}}
 // expected-error@any:* 2 {{calling a private constructor of class 'no_copy'}}
-}
\ No newline at end of file
+}
Index: test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
===
--- test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
+++ test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
@@ -68,21 +68,29 @@
 static_assert(std::is_same::value, "");
 }
 
-template 
-void checkThrows(any& a)
+template 
+void checkThrowsRvalue(any&, std::true_type)
+{}
+
+template 
+void checkThrowsRvalue(any& a, std::false_type)
 {
-#if !defined(TEST_HAS_NO_EXCEPTIONS)
 try {
-any_cast(a);
+any_cast(static_cast(a));
 assert(false);
 } catch (bad_any_cast const &) {
 // do nothing
 } catch (...) {
 assert(false);
 }
+}
 
+template 
+void checkThrows(any& a)
+{
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
 try {
-any_cast(static_cast(a));
+any_cast(a);
 assert(false);
 } catch (bad_any_cast const &) {
 // do nothing
@@ -91,13 +99,15 @@
 }
 
 try {
-any_cast(static_cast(a));
+any_cast(static_cast(a));
 assert(false);
 } catch (bad_any_cast const &) {
 // do nothing
 } catch (...) {
 assert(false);
 }
+
+checkThrowsRvalue(a, std::is_lvalue_reference{});
 #endif
 }
 
@@ -142,23 +152,7 @@
 Type const  = any_cast(ca);
 assert( == );
 }
-// Check getting a type by reference from a non-const rvalue
-{
-Type& v = any_cast(std::move(a));
-assert(v.value == 42);
-
-Type const  = any_cast(std::move(a));
-assert( == );
-}
-// Check getting a type by reference from a const rvalue any.
-{
-Type const& v = any_cast(std::move(ca));
-assert(v.value == 42);
-
-Type const  = any_cast(std::move(ca));
-assert( == );
-}
-// Check getting a type by reference from a const rvalue any.
+// Check getting a type by rvalue reference from a non-const rvalue any.
 {
 Type&& v = any_cast(std::move(a));
 assert(v.value == 42);
@@ -168,7 +162,7 @@
 assert( == );
 assert(any_cast(a).value == 42);