https://bugs.llvm.org/show_bug.cgi?id=40245
Bug ID: 40245
Summary: Missed guaranteed copy elision in delegating
constructor with ?: operator
Product: clang
Version: 7.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++'17
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
Created attachment 21300
--> https://bugs.llvm.org/attachment.cgi?id=21300&action=edit
reproducible source code
This particular case of a missed guaranteed copy elision prevents clang from
compiling libstdc++ std::optionals with types that are not trivially copyable.
The example reproducible source is a minimization of the implementation of
std::optional in libstdc++.
https://gcc.godbolt.org/z/5gK3So
The problem appears to be that clang is missing its obligation to elide the
copy in the delegating constructor that uses the ternary operator to choose
between two constructors to delegate to. The ternary (?:) operator is defined
as a prvalue, so I believe this should qualify for the guaranteed copy elision
in c++17.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs