public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "frankhb1989 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/94602] New: wrong semantic check to prvalue as decltype operand
Date: Wed, 15 Apr 2020 06:15:34 +0000 [thread overview]
Message-ID: <bug-94602-4@http.gcc.gnu.org/bugzilla/> (raw)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94602
Bug ID: 94602
Summary: wrong semantic check to prvalue as decltype operand
Product: gcc
Version: 9.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: frankhb1989 at gmail dot com
Target Milestone: ---
Case:
struct S
{
~S() = delete;
};
S f();
int main()
{
using X = decltype(f()); // #1
using Y = decltype(S{}); // #2
}
#2 is wrongly rejected in C++17 mode.
#1 is not ill-formed for the deleted destructor as per C++11
[dcl.type.simple]/5:
> ... in the case where the operand of a decltype-specifier
is a function call and the return type of the function is a class type, a
special rule (5.2.2) ensures that the return type is not required to be
complete (as it would be if the call appeared in a sub-expression or outside of
a
decltype-specifier) ... In particular, it is not necessary to allocate storage
for a temporary object or to enforce the semantic constraints associated with
invoking the type's destructor. ...
This rule is expanded by P0135R1 for cases like #2, which is adopted in C++17.
(See also P0929R2.)
reply other threads:[~2020-04-15 6:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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-94602-4@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).