diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-01-08 21:46:42 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-01-08 21:46:42 +0000 |
commit | 52b36918d6d762390bd2076f99d709b70f4c395f (patch) | |
tree | 4ffd8a329b44859df75e020f4c3c2e1283e84a25 /clang/test/SemaCXX/warn-missing-variable-declarations.cpp | |
parent | 59468f5a1edc8d1cc80c45f2c3012e1fad2be56e (diff) | |
download | bcm5719-llvm-52b36918d6d762390bd2076f99d709b70f4c395f.tar.gz bcm5719-llvm-52b36918d6d762390bd2076f99d709b70f4c395f.zip |
PR35862: Suppress -Wmissing-variable-declarations warning on inline variables,
variable templates, and instantiations thereof.
llvm-svn: 322030
Diffstat (limited to 'clang/test/SemaCXX/warn-missing-variable-declarations.cpp')
-rw-r--r-- | clang/test/SemaCXX/warn-missing-variable-declarations.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/warn-missing-variable-declarations.cpp b/clang/test/SemaCXX/warn-missing-variable-declarations.cpp index 5b882845f3c..5b71f38c811 100644 --- a/clang/test/SemaCXX/warn-missing-variable-declarations.cpp +++ b/clang/test/SemaCXX/warn-missing-variable-declarations.cpp @@ -1,4 +1,4 @@ -// RUN: %clang -Wmissing-variable-declarations -fsyntax-only -Xclang -verify %s +// RUN: %clang -Wmissing-variable-declarations -fsyntax-only -Xclang -verify -std=c++17 %s // Variable declarations that should trigger a warning. int vbad1; // expected-warning{{no previous extern declaration for non-static variable 'vbad1'}} @@ -52,3 +52,24 @@ class C { namespace { int vgood4; } + +inline int inline_var = 0; +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}} +extern constexpr int extern_constexpr_var = 0; // expected-warning {{no previous extern declaration}} + +template<typename> int var_template = 0; +template<typename> constexpr int const_var_template = 0; +template<typename> static int static_var_template = 0; + +template int var_template<int[1]>; +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}} + +// 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}} |