bug-gmp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C++ unary operator- return type issue?


From: David Buehler
Subject: C++ unary operator- return type issue?
Date: Tue, 25 Jan 2005 12:53:53 -0800

Hi there,

This is probably not a bug, but it seems odd and is inconvenient that
the program given below will not compile.  It appears that the return
type of the unary negation operator for mpz_class is not mpz_class?
There may be a good reason for it to (not) work the way it does?

I'm using GMP on a Debian system running the Testing distribution
(sarge).  "dpkg --list | fgrep gmp" reports:

ii  libgmp3        4.1.4-5        Multiprecision arithmetic library

The following program won't compile.  g++ says:
testbug.cpp:5: error: operands to ?: have different types

#include <gmpxx.h>
int main()
{
  mpz_class a = 1, b = 2, c;
  c = cmp(a,b) > 0 ? -b : a ;
}

David

-- 
David Buehler <address@hidden>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]