diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-03-26 22:25:30 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-03-26 22:25:30 +0000 |
commit | a172e088244e543ddcd5d8e79d848d6711e900a6 (patch) | |
tree | 2ca02d0fcf09b01f586f6f1930ce08a008111139 /clang/test/SemaCXX/warn-using-namespace-in-header.h | |
parent | e4663456752ff6160c0817afb732b83b7ef62cc2 (diff) | |
download | bcm5719-llvm-a172e088244e543ddcd5d8e79d848d6711e900a6.tar.gz bcm5719-llvm-a172e088244e543ddcd5d8e79d848d6711e900a6.zip |
Improve -Wheader-hygiene to warn about using directives inside linkage
specifications within the global scope, from Elliot Glaysher.
llvm-svn: 128352
Diffstat (limited to 'clang/test/SemaCXX/warn-using-namespace-in-header.h')
-rw-r--r-- | clang/test/SemaCXX/warn-using-namespace-in-header.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/warn-using-namespace-in-header.h b/clang/test/SemaCXX/warn-using-namespace-in-header.h index 677c4ac51ae..57bb5d91be4 100644 --- a/clang/test/SemaCXX/warn-using-namespace-in-header.h +++ b/clang/test/SemaCXX/warn-using-namespace-in-header.h @@ -13,3 +13,30 @@ using namespace warn_in_header_in_global_context; namespace dont_warn_here { using namespace warn_in_header_in_global_context; } + +// We should warn in toplevel extern contexts. +namespace warn_inside_linkage {} +extern "C++" { +using namespace warn_inside_linkage; +} + +// This is really silly, but we should warn on it: +extern "C++" { +extern "C" { +extern "C++" { +using namespace warn_inside_linkage; +} +} +} + +// But we shouldn't warn in extern contexts inside namespaces. +namespace dont_warn_here { +extern "C++" { +using namespace warn_in_header_in_global_context; +} +} + +// We also shouldn't warn in case of functions. +inline void foo() { + using namespace warn_in_header_in_global_context; +} |