public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "netcan1996 at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102229] [11/12 Regression] 'decltype(auto)' cannot be cv-qualified Date: Thu, 09 Sep 2021 13:56:33 +0000 [thread overview] Message-ID: <bug-102229-4-h2HtaG3HyS@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102229-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102229 --- Comment #7 from Net Can <netcan1996 at gmail dot com> --- here is my use case: https://github.com/netcan/config-loader/blob/master/include/config-loader/serialize/TypeSerializer.h the key is ```c++ #define TYPE_SERIALIZER(_type, _typeName) \ struct TypeSerializer<PARE _type> \ { static constexpr decltype(auto) name = _typeName; } template<> TYPE_SERIALIZER((int8_t), "int8_t"); // (1) template<typename T> TYPE_SERIALIZER((std::vector<T>), concat("vector<", TypeSerializer<T>::name, ">")); // (2) ``` in case (1), the `name` type is `const char(&)[N]`, but in case(2), the `name` type is `array[N]`, so I use `decltype(auto)` rather `auto`, becase latter loses char length info. I tried `static decltype(auto)` not work because it is defined in class, and requires `constexpr`.
next prev parent reply other threads:[~2021-09-09 13:56 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-07 13:33 [Bug c++/102229] New: " netcan1996 at gmail dot com 2021-09-07 14:36 ` [Bug c++/102229] " marxin at gcc dot gnu.org 2021-09-07 14:37 ` [Bug c++/102229] [11/12 Regression] " rguenth at gcc dot gnu.org 2021-09-07 14:43 ` mpolacek at gcc dot gnu.org 2021-09-07 15:17 ` mpolacek at gcc dot gnu.org 2021-09-07 19:43 ` jason at gcc dot gnu.org 2021-09-07 20:06 ` mpolacek at gcc dot gnu.org 2021-09-09 13:56 ` netcan1996 at gmail dot com [this message] 2021-09-09 15:08 ` jason at gcc dot gnu.org 2021-12-09 13:58 ` mpolacek at gcc dot gnu.org 2021-12-09 18:34 ` mpolacek at gcc dot gnu.org 2021-12-15 22:48 ` cvs-commit at gcc dot gnu.org 2021-12-15 22:52 ` [Bug c++/102229] [11 " mpolacek at gcc dot gnu.org 2022-01-03 23:45 ` cvs-commit at gcc dot gnu.org 2022-01-03 23:45 ` mpolacek 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-102229-4-h2HtaG3HyS@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).