71 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// expected-no-diagnostics3 4// C++0x [basic.lookup.unqual]p14:5// If a variable member of a namespace is defined outside of the6// scope of its namespace then any name used in the definition of7// the variable member (after the declarator-id) is looked up as if8// the definition of the variable member occurred in its namespace.9 10namespace N { 11 struct S {};12 S i; 13 extern S j;14 extern S j2;15} 16 17int i = 2; 18N::S N::j = i;19N::S N::j2(i);20 21namespace M {22 class X { };23 inline X operator-(int, X);24 25 template<typename T>26 class Y { };27 28 typedef Y<float> YFloat;29 30 namespace yfloat {31 YFloat operator-(YFloat, YFloat);32 }33 using namespace yfloat;34}35 36using namespace M;37 38namespace M {39 40class Other {41 void foo(YFloat a, YFloat b);42};43 44}45 46void Other::foo(YFloat a, YFloat b) {47 YFloat c = a - b;48}49 50namespace Other {51 void other_foo();52}53 54namespace M2 {55 using namespace Other;56 57 extern "C" {58 namespace MInner {59 extern "C" {60 class Bar { 61 void bar();62 };63 }64 }65 }66}67 68void M2::MInner::Bar::bar() {69 other_foo();70}71