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

Bug#489199: g++-4.3: getting "std::abs(int&) is ambiguous"



Package: g++-4.3
Version: 4.3.1-2
Severity: minor

This is an upstream bug, I believe.

I sincerely believe that std::abs should accept int& as an argument. Yet
for this small portion of code:

	template<int deltax, int deltay>
        inline static bool areInRange(const Position& p1, const Position& p2){
		if(std::abs(p1.x - p2.x) > deltax ||
			std::abs(p1.y - p2.y) > deltay){
				return false;
		}
		return true;
	}

Arguments are passed as references to Position. Position contains
integers, which are then obviously understood as references to integers
by the compiler. 

This worked fine with gcc 4.2.

Code is available in the OpenTibia project
	http://sf.net/projects/opentibia/
in the file position.h. I possibly added a cast to float to the version
you may be looking at, but you'll recognize that.

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (1000, 'testing'), (101, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-3-686 (SMP w/1 CPU core)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages g++-4.3 depends on:
ii  gcc-4.3                   4.3.1-2        The GNU C compiler
ii  gcc-4.3-base              4.3.1-2        The GNU Compiler Collection (base 
ii  libc6                     2.7-10         GNU C Library: Shared libraries
ii  libgmp3c2                 2:4.2.2+dfsg-3 Multiprecision arithmetic library
ii  libmpfr1ldbl              2.3.1.dfsg.1-2 multiple precision floating-point 
ii  libstdc++6-4.3-dev        4.3.1-2        The GNU Standard C++ Library v3 (d

g++-4.3 recommends no packages.

-- no debconf information



Reply to: