From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030922 Description of problem: g++ fails to generate executable code when -O2 is use, but g++ will generate code when code is unoptimized. The arrange_profile.ii available from ftp://people.redhat.com/wcohen/arrange_profiles.ii following command line works (no optimization): g++ -g -c -o arrange_profiles.o arrange_profiles.ii following fails with optimization: g++ -g -O2 -c -o arrange_profiles.o arrange_profiles.ii /usr/include/c++/3.3.2/bits/stl_function.h: In member function `bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = profile_class]': /usr/include/c++/3.3.2/bits/stl_tree.h:1042: instantiated from `std::pair<std::_Rb_tree_iterator<_Val, _Val&, _Val*>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::insert_unique(const _Val&) [with _Key = profile_class, _Val = profile_class, _KeyOfValue = std::_Identity<profile_class>, _Compare = std::less<profile_class>, _Alloc = std::allocator<profile_class>]' /usr/include/c++/3.3.2/bits/stl_set.h:155: instantiated from `std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, _Alloc>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const _Key&) [with _Key = profile_class, _Compare = std::less<profile_class>, _Alloc = std::allocator<profile_class>]' arrange_profiles.cpp:340: instantiated from here /usr/include/c++/3.3.2/bits/stl_function.h:197: error: no match for 'operator<' in '__x < __y' Version-Release number of selected component (if applicable): gcc-c++-3.3.2-5 libstdc++-devel-3.3.2-1 How reproducible: Always Steps to Reproduce: Look at the description above Actual Results: Failure listed above. Expected Results: Compiles successfully with -O2 Additional info: The original source code is OProfile cvs (2004/01/19), libpp/arrange_profiles.cpp
Works with g++ 3.4.2 (after replacing the preprocessed STL includes with #include directives).