[llvm-bugs] [Bug 48526] New: Correct example from [dcl.init] yields error
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Dec 15 14:43:26 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=48526
Bug ID: 48526
Summary: Correct example from [dcl.init] yields error
Product: clang
Version: 11.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: unassignedclangbugs at nondot.org
Reporter: konstantin.vladimirov 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
C++20 in [dcl.init] clause (17.6.2.2) have an example of what can happen with
different initialization of structure:
struct A { int a; int&& b; };
including these:
A a2(1, f()); // well-formed, but dangling reference
A a4(1.0, 1); // well-formed, but dangling reference
I simplified this a bit to
A a4(1, 2);
GCC works as expected:
https://godbolt.org/z/EE4rKK
But clang fails on both lines and produces error
--
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/20201215/3c757605/attachment.html>
More information about the llvm-bugs
mailing list