[Bug libstdc++/12183] defunctional operator lookup in templates within namespaces

rschiele at uni-mannheim dot de gcc-bugzilla@gcc.gnu.org
Fri Sep 5 15:26:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


rschiele at uni-mannheim dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
          Component|c++                         |libstdc++
         Resolution|INVALID                     |


------- Additional Comments From rschiele at uni-mannheim dot de  2003-09-05 15:26 -------
Ok, got the argument. 
 
But that means that I cannot use std::less with a class type I have defined an 
operator< for when I include iterator stuff because the ISO standard section 
24.4.1.3.13 requires that operator< is provided in namespace std, right? 
 
This means that the following program can never compile unless you remove the 
include for the iterator stuff, right? 
 
#include <functional> 
#include <iterator> 
 
class a; 
bool operator<(a&,a&); 
 
void g(a& f) { 
    f < f;          // ok 
    std::less<a> l; 
    l(f, f);        // error: no match for 'operator<' in 'x < y' 
} 
 
Is this a flaw in the standard or has anyone an idea how to fix this in 
libstdc++ implementation of std::less?



More information about the Gcc-bugs mailing list