This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/58815] Casting/Conversion operator for std::decimal not supported


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58815

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Something like:

Index: include/decimal/decimal
===================================================================
--- include/decimal/decimal    (revision 203915)
+++ include/decimal/decimal    (working copy)
@@ -250,8 +250,10 @@
     /// Conforming extension: Conversion from scalar decimal type.
     decimal32(__decfloat32 __z)            : __val(__z) {}

-    // 3.2.2.5  Conversion to integral type. (DISABLED)
-    //operator long long() const { return (long long)__val; }
+#if __cplusplus >= 201103L
+    // 3.2.2.5  Conversion to integral type.
+    explicit operator long long() const { return (long long)__val; }
+#endif

     // 3.2.2.6  Increment and decrement operators.
     decimal32& operator++()
@@ -333,8 +335,10 @@
     /// Conforming extension: Conversion from scalar decimal type.
     decimal64(__decfloat64 __z)            : __val(__z) {}

-    // 3.2.3.5  Conversion to integral type. (DISABLED)
-    //operator long long() const { return (long long)__val; }
+#if __cplusplus >= 201103L
+    // 3.2.3.5  Conversion to integral type.
+    explicit operator long long() const { return (long long)__val; }
+#endif

     // 3.2.3.6  Increment and decrement operators.
     decimal64& operator++()
@@ -417,8 +421,10 @@
     /// Conforming extension: Conversion from scalar decimal type.
     decimal128(__decfloat128 __z)        : __val(__z) {}

-    // 3.2.4.5  Conversion to integral type. (DISABLED)
-    //operator long long() const { return (long long)__val; }
+#if __cplusplus >= 201103L
+    // 3.2.4.5  Conversion to integral type.
+    explicit operator long long() const { return (long long)__val; }
+#endif

     // 3.2.4.6  Increment and decrement operators.
     decimal128& operator++()


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]