Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/ipa/devirt-17.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
/* We shall devirtualize to B::foo since it is the only live candidate of an anonymous type. */ /* { dg-do compile } */ /* { dg-options "-O2 -fdump-ipa-whole-program-details" } */ namespace { class B { public: virtual int foo(void) { return 0; } }; class A : public B { public: virtual int foo(void) { return 1; } }; } class B *b; void get_me_lost (void *); int main() { int c; if (c) { class A a; a.foo(); } else { b = new (class B); b->foo(); get_me_lost ((void *)&b); } return b->foo(); } /* { dg-final { scan-ipa-dump-not "builtin_unreachable" "whole-program"} } */ /* { dg-final { scan-ipa-dump "B::foo" "whole-program"} } */ /* { dg-final { scan-ipa-dump-not "A::foo" "whole-program"} } */