g++ release 4.1.1 compiles the following invalid code without detecting an error. It does correctly find the error with -pedantic. Interestingly (perhaps), it also correctly detects the ambiguous call where the argument involved is const - as demonstrated by the second compilation below with the macro C2 defined:
[EMAIL PROTECTED]:~/c++/compiler$ g++ -c conversion.ambig.c [EMAIL PROTECTED]:~/c++/compiler$ cat conversion.ambig.c class Source; class Destination { public: Destination() {} Destination (const Source& source) {} }; class Source { public: Source() {} operator Destination() const { return Destination();} }; Source source; Destination wolf = source; // ambiguous #ifdef C2 const Source source2; Destination wolf2 = source2; // ambiguous #endif [EMAIL PROTECTED]:~/c++/compiler$ g++ -D C2 conversion.ambig.c conversion.ambig.c:22: error: conversion from 'const Source' to 'Destination' is ambiguous conversion.ambig.c:14: note: candidates are: Source::operator Destination() const conversion.ambig.c:7: note: Destination::Destination(const Source&) [EMAIL PROTECTED]:~/c++/compiler$ [EMAIL PROTECTED]:~/c++/compiler$ [EMAIL PROTECTED]:~/c++/compiler$ gcc -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: /home/sjh/gcc/gcc-4.1.1/configure --prefix=/home/sjh/gcc/prefix/ --enable-languages=c,c++ Thread model: posix gcc version 4.1.1 [EMAIL PROTECTED]:~/c++/compiler$ -- Summary: accepts-invalid ambiguous between conversion function/constructor. related to const Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: greifel at megatop200 dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29188