[Bug c++/98077] C++ 17: Using alias template bug in gcc

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 1 13:11:10 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98077

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
           Keywords|                            |rejects-valid

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The testcase from the godbolt link is:

// { dg-options "-std=gnu++17" }
#include <functional>

template <typename T>
struct CallableTrait;

template <typename R, typename... Args>
struct CallableTrait<std::function<R(Args...)>>
{
    using ReturnType = R;
};

template <typename Callable>
using CallableTraitT =
CallableTrait<decltype(std::function{std::declval<Callable>()})>;

template <typename Callable>
auto test(Callable&&)
{
    using CallableInfo = CallableTraitT<Callable>;
    static_assert(!std::is_void_v<typename CallableInfo::ReturnType>);
}

int main()
{
    test([]() { return 42; });
}


It requires at least C++17.


More information about the Gcc-bugs mailing list