This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]