public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/98077] C++ 17: Using alias template bug in gcc Date: Tue, 01 Dec 2020 13:15:03 +0000 [thread overview] Message-ID: <bug-98077-4-41A5hhF5VJ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-98077-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98077 --- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- Reduced: template<typename T> T&& declval(); template<typename R> struct function { template<typename T> function(T) { } }; template<typename T> function(T) -> function<decltype(declval<T>()())>; template<typename T> constexpr bool is_void_v = false; template<> constexpr bool is_void_v<void> = true; template <typename T> struct CallableTrait; template <typename R> struct CallableTrait<function<R>> { using ReturnType = R; }; template <typename Callable> using CallableTraitT = CallableTrait<decltype(function{declval<Callable>()})>; template <typename Callable> auto test(Callable&&) { using CallableInfo = CallableTraitT<Callable>; static_assert(!is_void_v<typename CallableInfo::ReturnType>); } int main() { test([]() { return 42; }); } 98077.C: In instantiation of ‘auto test(Callable&&) [with Callable = main()::<lambda()>]’: 98077.C:34:29: required from here 98077.C:29:20: error: invalid use of incomplete type ‘struct CallableTrait<main()::<lambda()> >’ 29 | static_assert(!is_void_v<typename CallableInfo::ReturnType>); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98077.C:14:8: note: declaration of ‘struct CallableTrait<main()::<lambda()> >’ 14 | struct CallableTrait; | ^~~~~~~~~~~~~
next prev parent reply other threads:[~2020-12-01 13:15 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-01 7:15 [Bug c++/98077] New: " juergen.reiss at gmx dot de 2020-12-01 10:33 ` [Bug c++/98077] " redi at gcc dot gnu.org 2020-12-01 13:11 ` redi at gcc dot gnu.org 2020-12-01 13:15 ` redi at gcc dot gnu.org [this message] 2021-06-24 19:25 ` ppalka at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-98077-4-41A5hhF5VJ@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).