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++/12183] New: defunctional operator lookup in templates within namespaces


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

           Summary: defunctional operator lookup in templates within
                    namespaces
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rschiele at uni-mannheim dot de
                CC: gcc-bugs at gcc dot gnu dot org,tneumann at pi3 dot
                    informatik dot uni-mannheim dot de
 GCC build triplet: *-*-*
  GCC host triplet: *-*-*
GCC target triplet: *-*-*

In the following example the line marked with "ok" proves that an operator< 
exists for comparing two objects of class type a. 
 
In the line marked with 'error' this operator< can no longer been found from 
the used template, but according to how I understand the C++ standard it 
should. 
 
This problem occurs for all gcc versions I tested (2.95.x -- 3.4) on all 
platforms. 
 
Additional note: Intel's icc seems to have the same problem. Borland's 
compiler compiles the code just fine. 
 
class a; 
namespace b { 
    bool operator<(a&,a&); 
} 
using namespace b; 
 
namespace c { 
    template <class e> struct h { 
        bool operator()(e& x, e& y) { 
            return x < y; 
        } 
    }; 
    class d; 
    bool operator<(d, d); 
} 
 
using namespace c; 
 
void g(a& f) { 
    f < f;   // ok 
    h<a> l; 
    l(f, f); // error: no match for 'operator<' in 'x < y' 
}


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