summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/warn-missing-variable-declarations.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaCXX/warn-missing-variable-declarations.cpp')
-rw-r--r--clang/test/SemaCXX/warn-missing-variable-declarations.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/warn-missing-variable-declarations.cpp b/clang/test/SemaCXX/warn-missing-variable-declarations.cpp
index 5b71f38c811..e2480fd663b 100644
--- a/clang/test/SemaCXX/warn-missing-variable-declarations.cpp
+++ b/clang/test/SemaCXX/warn-missing-variable-declarations.cpp
@@ -1,11 +1,15 @@
-// RUN: %clang -Wmissing-variable-declarations -fsyntax-only -Xclang -verify -std=c++17 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wmissing-variable-declarations -std=c++17 %s
// Variable declarations that should trigger a warning.
int vbad1; // expected-warning{{no previous extern declaration for non-static variable 'vbad1'}}
+// expected-note@-1{{declare 'static' if the variable is not intended to be used outside of this translation unit}}
+
int vbad2 = 10; // expected-warning{{no previous extern declaration for non-static variable 'vbad2'}}
+// expected-note@-1{{declare 'static' if the variable is not intended to be used outside of this translation unit}}
namespace x {
int vbad3; // expected-warning{{no previous extern declaration for non-static variable 'vbad3'}}
+ // expected-note@-1{{declare 'static' if the variable is not intended to be used outside of this translation unit}}
}
// Variable declarations that should not trigger a warning.
@@ -58,7 +62,9 @@ const int const_var = 0;
constexpr int constexpr_var = 0;
inline constexpr int inline_constexpr_var = 0;
extern const int extern_const_var = 0; // expected-warning {{no previous extern declaration}}
+// expected-note@-1{{declare 'static' if the variable is not intended to be used outside of this translation unit}}
extern constexpr int extern_constexpr_var = 0; // expected-warning {{no previous extern declaration}}
+// expected-note@-1{{declare 'static' if the variable is not intended to be used outside of this translation unit}}
template<typename> int var_template = 0;
template<typename> constexpr int const_var_template = 0;
@@ -69,7 +75,9 @@ int use_var_template() { return var_template<int[2]>; }
template int var_template<int[3]>;
extern template int var_template<int[4]>;
template<> int var_template<int[5]>; // expected-warning {{no previous extern declaration}}
+// expected-note@-1{{declare 'static' if the variable is not intended to be used outside of this translation unit}}
// FIXME: We give this specialization internal linkage rather than inheriting
// the linkage from the template! We should not warn here.
template<> int static_var_template<int[5]>; // expected-warning {{no previous extern declaration}}
+// expected-note@-1{{declare 'static' if the variable is not intended to be used outside of this translation unit}}
OpenPOWER on IntegriCloud