Unexpected compiler error ( error: template argument 1 is invalid ) when using <limits> and using -m32 option on 64-bit system.

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

 



Hi,

I was playing with a very simple program ( limits.cpp ) as shown below.

#include <limits>
#include <iostream>
using namespace std;
int main()
{
        cout << numeric_limits<int>::has_infinity << endl;
        return 0;
}

on my system (Arch Linux: g++ (GCC) 4.7.0 20120505 (prerelease) ) on a
x86_64 system.

If I compile with

$ g++ -m64 limits.cpp

compilation succeeds. However if I compile as follows I get a rather
unhelpful error.

$ g++ -m32 limits.cpp
In file included from limits.cpp:1:0:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/limits:1405:35:
error: template argument 1 is invalid
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/limits:1479:44:
error: template argument 1 is invalid

Seems a very strange error message to give as I took a look at the
numeric_limits templates in the <limits> header file and it looks
perfectly valid.

Is this a bug or a "feature"?

Regards,
Dan.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux