1 // RUN: %check_clang_tidy %s cert-dcl58-cpp %t -- -- -std=c++1z -I %S/Inputs/Headers 2 3 #include "system-header-simulation.h" 4 5 namespace A { 6 namespace B { 7 int b; 8 } 9 } 10 11 namespace A { 12 namespace B { 13 int c; 14 } 15 } 16 17 namespace posix { 18 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: modification of 'posix' namespace can result in undefined behavior [cert-dcl58-cpp] 19 namespace vmi { 20 } 21 } 22 23 namespace std { 24 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: modification of 'std' namespace can 25 int stdInt; 26 } 27 28 namespace foobar { 29 namespace std { 30 int bar; 31 } 32 } 33 34 namespace posix::a { 35 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: modification of 'posix' namespace 36 } 37 38 enum class MyError { 39 ErrorA, 40 ErrorB 41 }; 42 43 namespace std { 44 template <> 45 struct is_error_code_enum<MyError> : std::true_type {}; 46 47 template<> 48 void swap<MyError>(MyError &a, MyError &b); 49 } 50 51 enum class MyError2 { 52 Error2A, 53 Error2B 54 }; 55 56 namespace std { 57 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: modification of 'std' namespace 58 template <> 59 struct is_error_code_enum<MyError2> : std::true_type {}; 60 61 int foobar; 62 } 63 64 using namespace std; 65 66 int x; 67 68