-
-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Labels
enhancementNew feature or requestNew feature or request
Description
以前某中3女子に質問をしたことがあって、
diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index 209f395..d920a7d 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -250,7 +250,10 @@ _GLIBCXX_END_NAMESPACE_VERSION
// 20.11.5.1 construction / copy / destroy
constexpr duration() = default;
- constexpr duration(const duration&) = default;
+ // NB: Make constexpr implicit. This cannot be explicitly
+ // constexpr, as any UDT that is not a literal type with a
+ // constexpr copy constructor will be ill-formed.
+ duration(const duration&) = default;
template<typename _Rep2, typename = typename
enable_if<is_convertible<_Rep2, rep>::value
という変更がどういう意味かを問い合わせたことがありました。
@yumetodo 直訳:暗黙にconstexpr指定される。非リテラル型な任意のUDT(User-Defined Type)に対して、constexprコピーコンストラクタはill-formedになるため、明示的にconstexpr指定すべきでない。
— 狂える中3女子ボレロ村上/陶芸C++er (@bolero_MURAKAMI) 2016年3月14日
@yumetodo つまり、duration<Rep> の Rep は非リテラル型なユーザ定義型である可能性があるため、明示的にconstexpr指定しないようにする変更。Rep がリテラル型である場合、トリビアルコピーコンストラクタは暗黙にconstexpr指定される。
— 狂える中3女子ボレロ村上/陶芸C++er (@bolero_MURAKAMI) 2016年3月14日
と回答していただきました。
さて、例えば
template<typename Int_>
struct Coordinate1Dimensional {
Int_ x{};
constexpr Coordinate1Dimensional() = default;
constexpr Coordinate1Dimensional(const Int_& x_) noexcept :x(x_) {};
};
をみると、上と全く同じ状況であることがわかります。
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request