public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58815] New: Casting/Conversion operator for std::decimal not supported
@ 2013-10-20 17:34 q1 at oxyba dot de
  2013-10-20 17:59 ` [Bug c++/58815] " daniel.kruegler at googlemail dot com
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: q1 at oxyba dot de @ 2013-10-20 17:34 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 3860 bytes --]

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

            Bug ID: 58815
           Summary: Casting/Conversion operator for std::decimal not
                    supported
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: q1 at oxyba dot de

it is not really a bug a rather something missing. 

example:

#include<decimal/decimal>
int main(){
  std::decimal::decimal64 x(101.5001);
  long y = static_cast<long>(x); // throws an error
  return 0;
}

this will throw an error

"... error: invalid static_cast from type ‘std::decimal::decimal64’ to type
‘long int’..."


i know that type working would work using methods of std::decimal::decimal64,
e.g.

#include<decimal/decimal>
int main(){
  std::decimal::decimal64 x(101.5001);
  long long y = std::decimal::decimal64_to_long_long(x); // look here
  return 0;
}

As I cannot cicumvent the problem with outside class definition, I please you
to add conversion operators to std::decimal, e.g.

std::decimal::decimal64::operator long(){return ...;} 


In general std::decimal is really immature, e.g. no operator<<, not supported
in <traits> (it says std::decimal is a floating point).
>From gcc-bugs-return-432275-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Oct 20 17:55:58 2013
Return-Path: <gcc-bugs-return-432275-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 26952 invoked by alias); 20 Oct 2013 17:55:57 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 26909 invoked by uid 48); 20 Oct 2013 17:55:55 -0000
From: "mikpelinux at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug inline-asm/58805] [4.8/4.9 Regression] Inline assembly wrongly optimized out when inside a conditional
Date: Sun, 20 Oct 2013 17:55:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: inline-asm
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mikpelinux at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.8.3
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc attachments.created
Message-ID: <bug-58805-4-HDmGDAKtVO@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58805-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58805-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-10/txt/msg01419.txt.bz2
Content-length: 636

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX805

Mikael Pettersson <mikpelinux at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpelinux at gmail dot com

--- Comment #9 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Created attachment 31055
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id1055&actioníit
adjusted test case

Adjusted test case, aborts when the wrong-code occurs, exits 0 otherwise.  This
wrong-code started with r186447.  CC:ing author.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-10-23 11:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-20 17:34 [Bug c++/58815] New: Casting/Conversion operator for std::decimal not supported q1 at oxyba dot de
2013-10-20 17:59 ` [Bug c++/58815] " daniel.kruegler at googlemail dot com
2013-10-21 21:50 ` q1 at oxyba dot de
2013-10-21 23:38 ` janis at gcc dot gnu.org
2013-10-21 23:50 ` janis at gcc dot gnu.org
2013-10-22  9:04 ` paolo.carlini at oracle dot com
2013-10-22  9:11 ` paolo.carlini at oracle dot com
2013-10-22  9:12 ` daniel.kruegler at googlemail dot com
2013-10-22 15:29 ` janis at gcc dot gnu.org
2013-10-22 15:43 ` paolo.carlini at oracle dot com
2013-10-22 17:43 ` q1 at oxyba dot de
2013-10-22 18:07 ` janis at gcc dot gnu.org
2013-10-22 18:20 ` paolo.carlini at oracle dot com
2013-10-22 20:02 ` [Bug libstdc++/58815] " paolo.carlini at oracle dot com
2013-10-23 11:48 ` paolo at gcc dot gnu.org
2013-10-23 11:50 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).