incompatibility of PGI compiler ?

T

Toon Knapen

Following small test-program (see below) compiles fine with multiple
versionS of gcc, icc, xlC, aCC, pathscale but not with the PGI compiler.
The PGI 6.1 compiler tells me following:

<error>
"test.cpp", line 12: error: more than one operator "<<" matches these
operands:
function "std::eek:perator<<(std::basic_ostream<char,
std::char_traits<char>> &, const
std::complex<double> &)"
function "mine::eek:perator<<(std::eek:stream &, const
std::complex<double> &)"
operand types are: std::eek:stream << std::complex<double>
std::cout << d << std::endl ;
^

1 error detected in the compilation of "test.cpp".
</error>

Now I'm wondering if PGI is right or all others are right? Due to Koenig
lookup the compiler logically is going to search in the std namespace
too so the error generated by PGI looks plausible.

Additionally, does anybody know of any unconforming behaviour of the PGI
compiler ?

Thanks,

toon


<test.cpp>
#include <complex>
#include <iostream>

namespace mine {

std::eek:stream& operator<<(std::eek:stream& os,std::complex<double> const & v)
{ std::cout << "mine::eek:perator<<" << std::endl ; return os ; }

void foo()
{
std::complex<double> d ;
std::cout << d << std::endl ;
}
}
</test.cpp>
 
B

Bob Hairgrove

Following small test-program (see below) compiles fine with multiple
versionS of gcc, icc, xlC, aCC, pathscale but not with the PGI compiler.

What compiler is this?
The PGI 6.1 compiler tells me following:

<error>
"test.cpp", line 12: error: more than one operator "<<" matches these
operands:
function "std::eek:perator<<(std::basic_ostream<char,
std::char_traits<char>> &, const
std::complex<double> &)"
function "mine::eek:perator<<(std::eek:stream &, const
std::complex<double> &)"
operand types are: std::eek:stream << std::complex<double>
std::cout << d << std::endl ;
^

1 error detected in the compilation of "test.cpp".
</error>

Now I'm wondering if PGI is right or all others are right? Due to Koenig
lookup the compiler logically is going to search in the std namespace
too so the error generated by PGI looks plausible.

Additionally, does anybody know of any unconforming behaviour of the PGI
compiler ?

Thanks,

toon


<test.cpp>
#include <complex>
#include <iostream>

You should also #include said:
namespace mine {

std::eek:stream& operator<<(std::eek:stream& os,std::complex<double> const & v)
{ std::cout << "mine::eek:perator<<" << std::endl ; return os ; }

void foo()
{
std::complex<double> d ;
std::cout << d << std::endl ;
}
}
</test.cpp>

Your code compiles and runs fine on MSVC++ ver. 7.1. Looks like a bug
in your compiler to me.
 
T

Toon Knapen

Bob said:
What compiler is this?

PGI? See http://www.pgroup.com/
xlC is IBM's compiler on IBM Aix

There are pretty well known for generating efficient code just like the
pathscale compiler.


Your code compiles and runs fine on MSVC++ ver. 7.1. Looks like a bug
in your compiler to me.


Probably but I'm trying to figure out on what grounds (i.e. based on
which paragraph(s) in the standard) ?

toon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,955
Messages
2,570,117
Members
46,705
Latest member
v_darius

Latest Threads

Top