public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-10253] libstdc++: Remove non-void static assertions in variant's std::get [PR111172]
@ 2024-03-18 14:06 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2024-03-18 14:06 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:15c517049c0d8b6319990445939a69bb36fdc678

commit r12-10253-g15c517049c0d8b6319990445939a69bb36fdc678
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Sep 12 21:28:38 2023 +0100

    libstdc++: Remove non-void static assertions in variant's std::get [PR111172]
    
    A void template argument would cause a substitution failure when trying
    to form a reference for the return type, so the function body would
    never be instantiated.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/111172
            * include/std/variant (get<T>): Remove !is_void static
            assertions.
    
    (cherry picked from commit d19bdf8874059457fdfe50a9e14dad8f8b8cecbb)

Diff:
---
 libstdc++-v3/include/std/variant | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index 64145da12bb..9abe7b9ed6d 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -1150,7 +1150,6 @@ namespace __variant
     {
       static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
 		    "T must occur exactly once in alternatives");
-      static_assert(!is_void_v<_Tp>, "_Tp must not be void");
       constexpr size_t __n = std::__find_uniq_type_in_pack<_Tp, _Types...>();
       return std::get<__n>(__v);
     }
@@ -1161,7 +1160,6 @@ namespace __variant
     {
       static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
 		    "T must occur exactly once in alternatives");
-      static_assert(!is_void_v<_Tp>, "_Tp must not be void");
       constexpr size_t __n = std::__find_uniq_type_in_pack<_Tp, _Types...>();
       return std::get<__n>(std::move(__v));
     }
@@ -1172,7 +1170,6 @@ namespace __variant
     {
       static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
 		    "T must occur exactly once in alternatives");
-      static_assert(!is_void_v<_Tp>, "_Tp must not be void");
       constexpr size_t __n = std::__find_uniq_type_in_pack<_Tp, _Types...>();
       return std::get<__n>(__v);
     }
@@ -1183,7 +1180,6 @@ namespace __variant
     {
       static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
 		    "T must occur exactly once in alternatives");
-      static_assert(!is_void_v<_Tp>, "_Tp must not be void");
       constexpr size_t __n = std::__find_uniq_type_in_pack<_Tp, _Types...>();
       return std::get<__n>(std::move(__v));
     }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-18 14:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-18 14:06 [gcc r12-10253] libstdc++: Remove non-void static assertions in variant's std::get [PR111172] Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).