public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ppalka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/92010] [8/9/10 Regression] gcc internal error since 8x on warning write-strings
Date: Thu, 12 Mar 2020 23:02:00 +0000 [thread overview]
Message-ID: <bug-92010-4-vgCW5ZOJLe@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-92010-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92010
--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #5)
> The ICE seems to be revealing a latent issue: In the following example
> (which GCC accepts), according to the static_assert labelled (1), the type
> of t is const int*, but according to the static_assert labelled (2), the
> type of t is int *const.
>
>
>
> template <typename T>
> void foo(const T t)
> {
> static_assert(__is_same(decltype(t), const int*)); // (1)
> }
>
> static_assert(__is_same(decltype(foo<int[]>), void(int *))); // (2)
>
> int
> main()
> {
> foo<int[]>(nullptr);
> }
So the question becomes, what should the type of t be here? According to
https://eel.is/c++draft/temp#deduct-3:
"A top-level qualifier in a function parameter declaration does not affect the
function type but still affects the type of the function parameter variable
within the function."
The above suggests that the type of foo<int[]> should be the same regardless of
where the parameter t is const-qualified. Going by this then, it appears that
the static_assert (2) is right and (1) is wrong. Can anyone confirm?
(On the other hand, Clang thinks (1) is right and (2) is wrong.)
next prev parent reply other threads:[~2020-03-12 23:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-92010-4@http.gcc.gnu.org/bugzilla/>
2020-03-12 15:29 ` ppalka at gcc dot gnu.org
2020-03-12 22:54 ` ppalka at gcc dot gnu.org
2020-03-12 23:02 ` ppalka at gcc dot gnu.org [this message]
2020-03-17 18:34 ` ppalka at gcc dot gnu.org
2020-04-08 14:17 ` cvs-commit at gcc dot gnu.org
2020-04-08 14:33 ` [Bug c++/92010] [8/9 " ppalka at gcc dot gnu.org
2021-04-21 21:25 ` ppalka at gcc dot gnu.org
2021-10-05 9:55 ` nickhuang99 at hotmail dot com
2021-10-05 14:23 ` ppalka at gcc dot gnu.org
2021-10-05 16:21 ` nickhuang99 at hotmail dot com
2021-10-05 21:05 ` ppalka at gcc dot gnu.org
2021-10-05 21:56 ` nickhuang99 at hotmail dot com
2021-10-05 22:08 ` nickhuang99 at hotmail dot com
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-92010-4-vgCW5ZOJLe@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: link
Be 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).