Skip to content

Instantly share code, notes, and snippets.

@visionscaper
Created April 28, 2012 10:56
Show Gist options
  • Save visionscaper/2517960 to your computer and use it in GitHub Desktop.
Save visionscaper/2517960 to your computer and use it in GitHub Desktop.
C++ compile error in stl_function.h: class member cannot be redeclared (binder1st) (in XCode 4.3.2)
I came across this compile error in XCode 4.3.2: In stl_function.h:
typename _Operation::result_type
operator()(const typename _Operation::second_argument_type& __x) const
{ return op(value, __x); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 109. Missing binders for non-const sequence elements
typename _Operation::result_type
operator()(typename _Operation::second_argument_type& __x) const <--------- Class member cannot be redeclared
{ return op(value, __x); }
There is a difference between the two declarations. I thought that I was maybe using the wrong compiler, so I switched from Apple LLVM compiler 3.1 to LLVM GCC 4.2. This resulted in another set of compile errors that I was able to solve (my code did build). After that I switched back to the Apple compiler and wasn't even able to reproduce the problem!
Bottomline : this is not a bug in de STL library but a problem in my own code, LLVM GCC 4.2 gave me better clues than Apple LLVM compile in this case.
I hope this helps anyone puzzled by this odd compile error.
-- Freddy
PS : this stl_function.h is in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/bits
@YangLin1998
Copy link

I have also encountered the same problem.(in Xcode8.3.3)
But i didn't use STL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment