[libcxx-commits] [PATCH] D129229: [libc++] reference_wrapper does not define nested types as described in C++11/14
Xing Xue via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jul 6 14:39:51 PDT 2022
xingxue created this revision.
xingxue added reviewers: ldionne, philnik, Mordante, hubert.reinterpretcast, daltenty, cebowleratibm.
xingxue added a project: LLVM.
Herald added a project: All.
xingxue requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
This patch tries to fix the issue that the implementation of `reference_wrapper` does not define nested types as described in C++11/14 standard section 20.8.3/20.9.3 `[refwrap]`. When `T` is a class with a nested type `argument_type` `T1`, the template instantiation `reference_wrapper<T>` shall define a nested type named `argument_type` as a synonym for `T1`. When `T` is a class with nested types named `first_argument_type` and `second_argument_type` of type `T1` and `T2`, the template instantiation `reference_wrapper<T>` shall define two nested types named `first_argument_type` and `second_argument_type` as synonyms for `T1` and `T2`, respectively. These types are deprecated in C++17 and removed in C++20.
The following test case demonstrates the issue.
#include <functional>
int main(void) {
struct S{
typedef int argument_type;
typedef long first_argument_type;
typedef float second_argument_type;
};
typedef std::reference_wrapper<S>::argument_type A1;
typedef std::reference_wrapper<S>::first_argument_type A2;
typedef std::reference_wrapper<S>::second_argument_type A3;
static_assert(std::is_same<S::argument_type, A1>::value, "");
static_assert(std::is_same<S::first_argument_type, A2>::value, "");
static_assert(std::is_same<S::second_argument_type, A3>::value, "");
return 0;
}
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D129229
Files:
libcxx/include/__functional/weak_result_type.h
libcxx/test/libcxx/utilities/function.objects/refwrap/refwrap_types.pass.cpp
libcxx/test/std/depr/depr.function.objects/depr.base/refwrap_types.depr.verify.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129229.442672.patch
Type: text/x-patch
Size: 6217 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220706/6113cd87/attachment-0001.bin>
More information about the libcxx-commits
mailing list