I've been porting type_traits from libstdc++ and came across a strange bug with the following code:
// Copyright (C) 2007-2020 Free Software Foundation, Inc.
// Copyright (C) 2020 Daniel Rossinsky <danielrossinsky@gmail.com>
//
// 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.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
namespace ustd
{
template<typename T, T v>
struct integral_constant
{
static constexpr T value = v;
using value_type = T;
using type = integral_constant;
constexpr operator value_type() const noexcept { return value; }
constexpr value_type operator()() const noexcept { return value; }
};
template<bool B>
using bool_constant = integral_constant<bool, B>;
using false_type = bool_constant<false>;
using true_type = bool_constant<true>;
template<typename T, typename... Args>
struct is_constructible_helper
: bool_constant<__is_constructible(T, Args...)> {};
}
It produces the following error:
error: template argument 1 is invalid
: bool_constant<__is_constructible(T, Args...)> {};
^
I tried searching for solutions and both this and this doesn't solve my problem and I'm starting to think that the compiler magic function __is_constructible may be the problem however others like __is_class work without a problem in avr-gcc which leaves me with more questions than answers.
NOTE: Also the IDE version I'm using is 1.8.13.