p3.cpp 509 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // RUN: %clang_cc1 -fsyntax-only -verify %s
  2. // expected-no-diagnostics
  3. // This is basically paraphrased from the standard.
  4. namespace Root {
  5. int i = 0;
  6. void f();
  7. }
  8. namespace A {
  9. using namespace Root;
  10. }
  11. namespace B {
  12. using namespace Root;
  13. }
  14. namespace AB {
  15. using namespace A;
  16. using namespace B;
  17. }
  18. void test() {
  19. if (AB::i)
  20. AB::f();
  21. }
  22. namespace C {
  23. using Root::i;
  24. using Root::f;
  25. }
  26. namespace AC {
  27. using namespace A;
  28. using namespace C;
  29. }
  30. void test2() {
  31. if (AC::i)
  32. AC::f();
  33. }