[llvm-bugs] [Bug 45542] New: wrong semantic check to prvalue as decltype operand
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Apr 14 23:21:32 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45542
Bug ID: 45542
Summary: wrong semantic check to prvalue as decltype operand
Product: clang
Version: 9.0
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++17
Assignee: unassignedclangbugs at nondot.org
Reporter: frankhb1989 at gmail.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
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.)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200415/bc9d86ec/attachment.html>
More information about the llvm-bugs
mailing list