PR libstdc++/81076 make __byte_operand SFINAE-friendly

PR libstdc++/81076
	* include/c_global/cstddef (__byte_operand): Define primary template.
	* testsuite/18_support/byte/81076.cc: New test.

From-SVN: r257050
This commit is contained in:
Jonathan Wakely 2018-01-25 15:24:39 +00:00
parent e3b18df45b
commit 58078de77b
3 changed files with 34 additions and 2 deletions

View 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.

View 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; };

View File

@ -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;