// RUN: %clang_cc1 -fsyntax-only %s -verify
// C++'0x [namespace.memdef] p3:
// Every name first declared in a namespace is a member of that namespace. If
// a friend declaration in a non-local class first declares a class or
// function the friend class or function is a member of the innermost
// enclosing namespace.
N::F0 f0_var = ;
// Ensure we can handle attaching friend declarations to an enclosing namespace
// with multiple contexts.
N::F1 f1_var = ;
// The name of the friend is not found by unqualified lookup (3.4.1) or by
// qualified lookup (3.4.3) until a matching declaration is provided in that
// namespace scope (either before or after the class definition granting
// friendship). If a friend function is called, its name may be found by the
// name lookup that considers functions from namespaces and classes
// associated with the types of the function arguments (3.4.2). If the name
// in a friend declaration is neither qualified nor a template-id and the
// declaration is a function or an elaborated-type-specifier, the lookup to
// determine whether the entity has been previously declared shall not
// consider any scopes outside the innermost enclosing namespace.
;
;
;
// FIXME: Woefully inadequate for testing
// Friends declared as template-ids aren't subject to the restriction
// on innermost namespaces.
// rdar://problem/8552377
// rdar://13393749
// We seem to be following a correct interpretation with these, but
// the standard could probably be a bit clearer.