From 58078de77b2b22bb36d28daf2a7fe79397d5f057 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 25 Jan 2018 15:24:39 +0000 Subject: [PATCH] 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 --- libstdc++-v3/ChangeLog | 8 +++++- libstdc++-v3/include/c_global/cstddef | 2 +- .../testsuite/18_support/byte/81076.cc | 26 +++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 libstdc++-v3/testsuite/18_support/byte/81076.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 023e12902bc..c856221c6bf 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,7 +1,13 @@ +2018-01-25 Jonathan Wakely + + 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 * 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. diff --git a/libstdc++-v3/include/c_global/cstddef b/libstdc++-v3/include/c_global/cstddef index af36cc0b8b9..36d7d716cc3 100644 --- a/libstdc++-v3/include/c_global/cstddef +++ b/libstdc++-v3/include/c_global/cstddef @@ -65,7 +65,7 @@ namespace std /// std::byte enum class byte : unsigned char {}; - template struct __byte_operand; + template struct __byte_operand { }; template<> struct __byte_operand { using __type = byte; }; template<> struct __byte_operand { using __type = byte; }; template<> struct __byte_operand { 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 index 00000000000..0ba0b1276bc --- /dev/null +++ b/libstdc++-v3/testsuite/18_support/byte/81076.cc @@ -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 +// . + +// { dg-options "-std=gnu++17" } +// { dg-do compile { target c++17 } } + +#include + +template void to_integer(...); + +using T = decltype(to_integer(std::byte{})); +using T = void; -- 2.30.2