473,386 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

incompatibility of PGI compiler ?

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::operator<<(std::basic_ostream<char,
std::char_traits<char>> &, const
std::complex<double> &)"
function "mine::operator<<(std::ostream &, const
std::complex<double> &)"
operand types are: std::ostream << 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::ostream& operator<<(std::ostream& os,std::complex<double> const & v)
{ std::cout << "mine::operator<<" << std::endl ; return os ; }

void foo()
{
std::complex<double> d ;
std::cout << d << std::endl ;
}
}
</test.cpp>
Mar 3 '06 #1
2 2136
On Fri, 03 Mar 2006 13:25:52 +0100, Toon Knapen
<"reverse[nepank.noot]"@fft.be> wrote:
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::operator<<(std::basic_ostream<char,
std::char_traits<char>> &, const
std::complex<double> &)"
function "mine::operator<<(std::ostream &, const
std::complex<double> &)"
operand types are: std::ostream << 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 <ostream> here...
namespace mine {

std::ostream& operator<<(std::ostream& os,std::complex<double> const & v)
{ std::cout << "mine::operator<<" << 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.

--
Bob Hairgrove
No**********@Home.com
Mar 3 '06 #2
Bob Hairgrove wrote:
On Fri, 03 Mar 2006 13:25:52 +0100, Toon Knapen
<"reverse[nepank.noot]"@fft.be> wrote:

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?


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
Mar 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: hannibal | last post by:
Hi i have a netscape and IE incompatibility problem. when i change the text size in netscape everything looks fine and all frames text size change . but when i change the text size in IE just...
6
by: przemek drochomirecki | last post by:
Hi, I don't understand the idea behind the error in the following code... int foo(const char **p) { return 0; } int main(int argc, char **argv) { foo(argv);
7
by: Zara | last post by:
I am trying to publish one function in a template based on and derived of, a base class. The code tested in GCC works fine, and AFAIK is standard ISO. But I do have to make an inline fucntio for...
6
by: m0002a | last post by:
I have sucessfully set up an HADR pair of databases. Everthing works fine for the primary and secondary HADR databases, and manual takeover works fine. When I try to set up the second pair of...
3
by: Joshua Moore | last post by:
I have a webservice that serializes a ton of variables and other good stuff to a txt file using SoapFormatter (IFormatter), and when I try to deserialize it using the binary formatter, i get the...
2
by: Doug Lind | last post by:
Hi all, I have seen a number of posts re: the BinaryFormatter version incompatibility but nothing on how to recover from it. In my case, I want the exception to trigger an alternate behaviour...
0
by: GG | last post by:
Does anybody know the msdn website that shows the incompatibility between vs2005 and vs2003? Thanks *** Sent via Developersdex http://www.developersdex.com ***
5
by: J | last post by:
I have installed dotnet 2.0 on two machines with Outlook BCM, and both have caused problems with BCM loading. The first i restored the machine to before the dotnet 2.0 was installed, and the second...
4
by: rlrcstr | last post by:
I'm getting an annoying exception: BinaryFormatter Version incompatibility. Expected Version 1.0. Received Version XXXX I've looked all over the web and everything that discusses this seems to...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.