brintos

brintos / llvm-project-archived public Read only

0
0
Text · 978 B · b2d6d32 Raw
39 lines · cpp
1// RUN: cp %s %t2// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++983// RUN: not %clang_cc1 -x c++ -std=c++14 -fixit %t -Werror -DFIXIT4// RUN: %clang_cc1 -x c++ -std=c++14 %t -DFIXIT5// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17 -Wc++14-compat6 7namespace foo1::foo2::foo3 {8#if __cplusplus <= 201400L9// expected-warning@-2 {{nested namespace definition is a C++17 extension; define each namespace separately}}10#else11// expected-warning@-4 {{nested namespace definition is incompatible with C++ standards before C++17}}12#endif13  int foo(int x) { return x; }14}15 16#ifndef FIXIT17inline namespace goo::bar { // expected-error {{nested namespace definition cannot be 'inline'}} expected-warning 0-1{{C++11 feature}}18  int n;19}20 21int m = goo::bar::n;22#endif23 24int foo(int x) {25  return foo1::foo2::foo3::foo(x);26}27 28namespace bar1 {29  namespace bar2 {30    namespace bar3 {31      int bar(int x) { return x; }32    }33  }34}35 36int bar(int x) {37  return bar1::bar2::bar3::bar(x);38}39