diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/init/const5.C')
-rw-r--r-- | gcc/testsuite/g++.dg/init/const5.C | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/init/const5.C b/gcc/testsuite/g++.dg/init/const5.C new file mode 100644 index 000000000..fa8d8fc23 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/const5.C @@ -0,0 +1,11 @@ +// PR c++/31449 + +class Foo {}; +class Bar : public Foo {}; +static const Foo *foo = 0; + +static Bar *bar = static_cast<const Bar*>(foo); // { dg-error "conversion" } + +void func(const Foo *foo) { + Bar *bar = static_cast<const Bar*>(foo); // { dg-error "conversion" } +} |