From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/g++.dg/warn/Wunused-var-3.C | 110 ++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/Wunused-var-3.C (limited to 'gcc/testsuite/g++.dg/warn/Wunused-var-3.C') diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-3.C b/gcc/testsuite/g++.dg/warn/Wunused-var-3.C new file mode 100644 index 000000000..cd8931d71 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wunused-var-3.C @@ -0,0 +1,110 @@ +// { dg-options "-Wunused -W" } + +#include +#include + +void +f1 (int a, ...) +{ + va_list ap; + va_start (ap, a); + va_end (ap); +} + +int +f2 (int a, ...) +{ + va_list ap; + va_start (ap, a); + int i = va_arg (ap, int); + va_end (ap); + return i; +} + +struct A { int a; A (); virtual ~A (); }; +struct B : virtual A { int b; }; + +struct B * +f3 (struct A *a) +{ + return dynamic_cast (a); +} + +struct A * +f4 (struct B *a) +{ + return static_cast (a); +} + +struct A * +f5 (struct B *a) +{ + return reinterpret_cast (a); +} + +struct A * +f6 (const struct A *a) +{ + return const_cast (a); +} + +int +f7 (long a) +{ + return (int) a; +} + +int +f8 (long a) +{ + return int (a); +} + +struct C +{ + operator unsigned int() { return 42; } +}; + +unsigned int +f9 () +{ + C u; + return u; +} + +struct D +{ + operator int & (); + operator const int & () const; +}; + +void foo (int &); +void foo (const int &); + +void +f10 () +{ + const D x = D (); + foo (x); +} + +int +f11 (int a) +{ + return typeid (a) == typeid (int); +} + +struct E +{ + int e () {return 0;} +}; + +template +int +f12 (E a) +{ + __decltype (a.e()) i; + return i; +} + +template <> int f12 (E); -- cgit v1.2.3