[PATCH] D153375: [Clang] Fix incorrect use of direct initialization with copy initialization
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 30 15:42:34 PDT 2023
rsmith added inline comments.
================
Comment at: clang/lib/Sema/SemaExpr.cpp:15441-15443
// C++11 5.17p9:
// The meaning of x = {v} [...] is that of x = T(v) [...]. The meaning
// of x = {} is x = T().
----------------
The code change doesn't match this comment, which says we should use direct non-list initialization. Though the comment is slightly wrong / out of date: the standard text now says:
"an assignment to a scalar, in which case the initializer list shall have at most a single element. The meaning of `x = {v}`, where `T` is the scalar type of the expression `x`, is that of `x = T{v}`. The meaning of `x = {}` is `x = T{}`."
... which says to use direct list initialization to create a temporary in the scalar type case.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153375/new/
https://reviews.llvm.org/D153375
More information about the cfe-commits
mailing list