[Bug c++/13907] New: pedantic needed to disambiguate

japple at freeshell dot org gcc-bugzilla@gcc.gnu.org
Thu Jan 29 00:13:00 GMT 2004


struct A {
  operator int & ();
  operator const int & () const;
};
                                                                               
          
void f(int &);
void f(const int &);
                                                                               
          
int main() {
  const A x = A();
  f(x);
}

gives

const_overload.cpp: In function `int main()':
const_overload.cpp:12: error: call of overloaded `f(const A&)' is ambiguous
const_overload.cpp:7: error: candidates are: void f(int&)
const_overload.cpp:8: error:                 void f(const int&)

unless -pedantic is set.

-- 
           Summary: pedantic needed to disambiguate
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: japple at freeshell dot org
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: x86 linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13907



More information about the Gcc-bugs mailing list