diff options
author | Marek Polacek <polacek@redhat.com> | 2024-06-18 10:50:49 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2024-06-25 15:07:46 -0400 |
commit | 71f484d02b2b3e8616cd7af27a0d4c72e4c7e977 (patch) | |
tree | ad7101f7bd8620fa1804e0b262bfa99fa9078195 /gcc/testsuite/g++.dg | |
parent | 3b9b8d6cfdf59337f4b7ce10ce92a98044b2657b (diff) | |
download | gcc-71f484d02b2b3e8616cd7af27a0d4c72e4c7e977.zip gcc-71f484d02b2b3e8616cd7af27a0d4c72e4c7e977.tar.gz gcc-71f484d02b2b3e8616cd7af27a0d4c72e4c7e977.tar.bz2 |
c++: ICE with __dynamic_cast redecl [PR115501]
Since r13-3299, build_dynamic_cast_1 calls pushdecl which calls
duplicate_decls and that in this testcase emits the "conflicting
declaration" error and returns error_mark_node, so the subsequent
build_cxx_call crashes on the error_mark_node.
PR c++/115501
gcc/cp/ChangeLog:
* rtti.cc (build_dynamic_cast_1): Return if dcast_fn is erroneous.
gcc/testsuite/ChangeLog:
* g++.dg/rtti/dyncast8.C: New test.
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r-- | gcc/testsuite/g++.dg/rtti/dyncast8.C | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/rtti/dyncast8.C b/gcc/testsuite/g++.dg/rtti/dyncast8.C new file mode 100644 index 0000000..de23433 --- /dev/null +++ b/gcc/testsuite/g++.dg/rtti/dyncast8.C @@ -0,0 +1,15 @@ +// PR c++/115501 +// { dg-do compile } + +struct s{virtual void f();}; +struct s1 : s{}; +namespace __cxxabiv1 +{ + extern "C" void __dynamic_cast(); // { dg-message "previous declaration" } +} +void diagnostic_information_impl(s const *se) +{ + dynamic_cast<s1 const *>(se); +} + +// { dg-error "conflicting declaration" "" { target *-*-* } 0 } |