PR libstdc++/81076 make __byte_operand SFINAE-friendly
authorJonathan Wakely <redi@gcc.gnu.org>
Thu, 25 Jan 2018 15:24:39 +0000 (15:24 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 25 Jan 2018 15:24:39 +0000 (15:24 +0000)
PR libstdc++/81076
* include/c_global/cstddef (__byte_operand): Define primary template.
* testsuite/18_support/byte/81076.cc: New test.

From-SVN: r257050

libstdc++-v3/ChangeLog
libstdc++-v3/include/c_global/cstddef
libstdc++-v3/testsuite/18_support/byte/81076.cc [new file with mode: 0644]

index 023e12902bc673f9300200a98097716518f37ef8..c856221c6bf733707e8b8e2ac2bb19347e693c0f 100644 (file)
@@ -1,7 +1,13 @@
+2018-01-25  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR libstdc++/81076
+       * include/c_global/cstddef (__byte_operand): Define primary template.
+       * testsuite/18_support/byte/81076.cc: New test.
+
 2018-01-19  Christophe Lyon  <christophe.lyon@linaro.org>
 
        * testsuite/ext/special_functions/airy_ai/check_nan.cc: Fix
-          dg-options and dg-add-options order.
+       dg-options and dg-add-options order.
        * testsuite/ext/special_functions/airy_bi/check_nan.cc: Likewise.
        * testsuite/ext/special_functions/conf_hyperg/check_nan.cc:
        Likewise.
index af36cc0b8b9de4897a57c7c240fdf6a972fea1ee..36d7d716cc38a0bff6ee0e02758a14f8fe63d577 100644 (file)
@@ -65,7 +65,7 @@ namespace std
   /// std::byte
   enum class byte : unsigned char {};
 
-  template<typename _IntegerType> struct __byte_operand;
+  template<typename _IntegerType> struct __byte_operand { };
   template<> struct __byte_operand<bool> { using __type = byte; };
   template<> struct __byte_operand<char> { using __type = byte; };
   template<> struct __byte_operand<signed char> { using __type = byte; };
diff --git a/libstdc++-v3/testsuite/18_support/byte/81076.cc b/libstdc++-v3/testsuite/18_support/byte/81076.cc
new file mode 100644 (file)
index 0000000..0ba0b12
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright (C) 2018 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++17 } }
+
+#include <cstddef>
+
+template<class> void to_integer(...);
+
+using T = decltype(to_integer<void* const>(std::byte{}));
+using T = void;