diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/warn/oldcast1.C')
-rw-r--r-- | gcc/testsuite/g++.dg/warn/oldcast1.C | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/warn/oldcast1.C b/gcc/testsuite/g++.dg/warn/oldcast1.C new file mode 100644 index 000000000..26c0a5c4d --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/oldcast1.C @@ -0,0 +1,16 @@ +// { dg-do compile } +// { dg-options "-ansi -pedantic-errors -Wold-style-cast" } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 26 Dec 2001 <nathan@codesourcery.com> + +// PR 5089. old style cast to void should be permitted (think assert) + +void foo () +{ + int i; + float f = (float)i; // { dg-warning "use of old-style cast" "" } + + (void)i; +} + |