aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/Wunused-var-8.c
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@redhat.com>2010-05-17 17:24:32 +0000
committerJakub Jelinek <jakub@gcc.gnu.org>2010-05-17 19:24:32 +0200
commitad13f2299cefa72529059e21385c4c49f1491181 (patch)
tree786dcd92a7ad0fc0015905fd8c1894a4eca21613 /gcc/testsuite/c-c++-common/Wunused-var-8.c
parentf145213fcc63518e181ae5b74a38f75555f6a741 (diff)
downloadgcc-ad13f2299cefa72529059e21385c4c49f1491181.zip
gcc-ad13f2299cefa72529059e21385c4c49f1491181.tar.gz
gcc-ad13f2299cefa72529059e21385c4c49f1491181.tar.bz2
re PR c++/44108 (-Wunused-but-set-variable does not consider array sizing use of a const variable)
PR c++/44108 * decl.c (compute_array_index_type): Call mark_rvalue_use. * c-c++-common/Wunused-var-8.c: New test. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r159497
Diffstat (limited to 'gcc/testsuite/c-c++-common/Wunused-var-8.c')
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-8.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-8.c b/gcc/testsuite/c-c++-common/Wunused-var-8.c
new file mode 100644
index 0000000..0923b35
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-8.c
@@ -0,0 +1,19 @@
+/* Origin: PR c++/44108 */
+/* { dg-options "-Wunused" } */
+/* { dg-do compile } */
+
+int
+foo ()
+{
+ unsigned int M = 2;
+ const unsigned int M_CONST = 2;
+ static unsigned int M_STATIC = 2;
+ static const unsigned int M_STATIC_CONST = 2;
+
+ char n1[M];
+ char n2[M_CONST];
+ char n3[M_STATIC];
+ char n4[M_STATIC_CONST];
+
+ return sizeof (n1) + sizeof (n2) + sizeof (n3) + sizeof (n4);
+}