+2015-08-20 Jason Merrill <jason@redhat.com>
+
+ * name-lookup.c (hidden_name_p): Handle OVERLOAD.
+
2015-08-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/67065
&& TYPE_FUNCTION_OR_TEMPLATE_DECL_P (val)
&& DECL_ANTICIPATED (val))
return true;
+ if (TREE_CODE (val) == OVERLOAD)
+ {
+ for (tree o = val; o; o = OVL_CHAIN (o))
+ if (!hidden_name_p (OVL_FUNCTION (o)))
+ return false;
+ return true;
+ }
return false;
}
--- /dev/null
+namespace std {
+ class ostream;
+}
+
+namespace N2 {
+ class C0 {};
+}
+
+std::ostream& operator<<( std::ostream& os_, const N2::C0& m_);
+
+namespace N1 {
+ class C1 {
+ friend std::ostream& operator<<(std::ostream& os, const C1& what);
+ };
+
+ class C2 {
+ friend std::ostream& operator<<(std::ostream& os, const C2& what);
+ };
+
+ void foo(std::ostream & os, const N2::C0& m)
+ {
+ os << m; // Is this line valid?
+ }
+}
struct Inner;
template <typename R>
- friend typename X<R>::Inner * foo () { return 0; }
+ friend typename X<R>::Inner * foo (X<R>*) { return 0; }
};
template class X<void>;
+X<void>* p;
struct U {
- void bar () { foo<void> (); }
+ void bar () { foo (p); }
};
template <int N> struct X
{
- template <int M> friend int foo(X const &)
+ template <int M> friend int foo(X const &, X<M> const&)
{
return N * 10000 + M;
}
};
X<1234> bring;
+X<5678> brung;
int main() {
- return foo<5678> (bring) != 12345678;
+ return foo (bring, brung) != 12345678;
}
};
template class S<int, double>;
-template char f(char, long, short);
-template char* f(char*, long*, short*);
+template char f(char, long, short); // { dg-error "f" }
+template char* f(char*, long*, short*); // { dg-error "f" }
template <class X, class Y, class Z>
X f(X x, Y, Z) {