[LLVMbugs] [Bug 12027] New: std::map<S, T>::erase(iterator) is ambiguous if S has a template constructor
    bugzilla-daemon at llvm.org 
    bugzilla-daemon at llvm.org
       
    Fri Feb 17 08:57:31 PST 2012
    
    
  
http://llvm.org/bugs/show_bug.cgi?id=12027
             Bug #: 12027
           Summary: std::map<S,T>::erase(iterator) is ambiguous if S has a
                    template constructor
           Product: libc++
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
        AssignedTo: hhinnant at apple.com
        ReportedBy: SebastianLuther at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified
The following code is a reduced test case from boost.signals. gcc-4.5 accepts
it without warning.
###############################################
#include <map>
struct S
{
   template<typename T>
   S(const T& t) {}
};
void test()
{
  typedef std::map<S,int> Map;
  Map m;
  Map::iterator it;
  m.erase(it);
}
###############################################
# clang++ -std=c++0x -stdlib=libc++ -c test-case.cpp 
test-case.cpp:15:5: error: call to member function 'erase' is ambiguous
  m.erase(it);
  ~~^~~~~
/usr/include/c++/v1/map:964:14: note: candidate function
    iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
             ^
/usr/include/c++/v1/map:966:15: note: candidate function
    size_type erase(const key_type& __k)
              ^
/usr/include/c++/v1/map:969:15: note: candidate function not viable: requires 2
arguments, but 1 was provided
    iterator  erase(const_iterator __f, const_iterator __l)
              ^
1 error generated.
-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
    
    
More information about the llvm-bugs
mailing list