diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-10-28 04:47:21 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-10-28 04:47:21 +0000 |
| commit | 27501e787c945e1f344072468d6b695d2b8827a9 (patch) | |
| tree | 8ca5dc47d8a3ab7a5a8e248a7f20264dfa63cc59 /clang/test/SemaCXX | |
| parent | 44938a738a6cfd1b566186a6a2a0e5ab5250dfba (diff) | |
| download | bcm5719-llvm-27501e787c945e1f344072468d6b695d2b8827a9.tar.gz bcm5719-llvm-27501e787c945e1f344072468d6b695d2b8827a9.zip | |
In -Wunneeded-internal-declaration, suppress the warning for variables which
might have been used in constant expressions, rather than suppressing it for
variables which are const. The important thing here is that such variables
can have their values used without actually being marked as 'used'.
llvm-svn: 166896
Diffstat (limited to 'clang/test/SemaCXX')
| -rw-r--r-- | clang/test/SemaCXX/warn-unused-filescoped.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/warn-unused-filescoped.cpp b/clang/test/SemaCXX/warn-unused-filescoped.cpp index dbff4b0e68c..328d8bbb5b4 100644 --- a/clang/test/SemaCXX/warn-unused-filescoped.cpp +++ b/clang/test/SemaCXX/warn-unused-filescoped.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -Wunused -Wunused-member-function %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wunused -Wunused-member-function -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wunused -Wunused-member-function -std=c++11 %s static void f1(); // expected-warning{{unused}} @@ -87,3 +88,15 @@ namespace rdar8733476 { foo(); } } + +namespace test5 { + static int n = 0; + static int &r = n; + int f(int &); + int k = f(r); + + static const int m = n; // expected-warning {{not needed and will not be emitted}} + int x = sizeof(m); + static const double d = 0.0; // expected-warning {{not needed and will not be emitted}} + int y = sizeof(d); +} |

