[cfe-commits] r129339 - in /cfe/trunk: lib/Sema/SemaLookup.cpp test/SemaObjCXX/argument-dependent-lookup.mm

Douglas Gregor dgregor at apple.com
Fri Apr 15 08:27:51 PDT 2011


On Apr 14, 2011, at 6:02 PM, Nico Weber wrote:

> Hi Doug,
> 
> this change breaks the following program, which builds fine with gcc
> and used to build fine with clang:
> 
> #import <AppKit/AppKit.h>
> 
> #include <iostream>
> using namespace std;
> 
> template <typename T>
> inline void g(std::ostream* os, const T& val) {
>  *os << val;
> }
> 
> std::ostream& operator<<(std::ostream& out, const NSObject* obj) {
>  return out << "asdf";
> }
> 
> void f(ostream& out, const NSEvent* e) {
>  g(&out, e);
> }
> 
> 
> Is this intended?


It's intended that ADL is finding the later operator<<. However, it looks like overloading isn't preferring the conversion-to-superclass over the conversion-to-void*.

	- Doug



More information about the cfe-commits mailing list