From: jakub Date: Thu, 11 Oct 2018 07:07:22 +0000 (+0000) Subject: PR c++/87547 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7613becb7c351afe89a2bb637cb1672a568a9de1;p=thirdparty%2Fgcc.git PR c++/87547 * rtti.c (get_tinfo_decl_dynamic): Use unlowered_expr_type instead of TREE_TYPE. * g++.dg/rtti/typeid12.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@265033 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index af8cb764139e..0ac28f934d98 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-10-11 Jakub Jelinek + + PR c++/87547 + * rtti.c (get_tinfo_decl_dynamic): Use unlowered_expr_type instead + of TREE_TYPE. + 2018-10-10 Marek Polacek PR c++/87567 - constexpr rejects call to non-constexpr function. diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 94a921987815..a0629e193604 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -273,7 +273,7 @@ get_tinfo_decl_dynamic (tree exp, tsubst_flags_t complain) exp = resolve_nondeduced_context (exp, complain); /* peel back references, so they match. */ - type = non_reference (TREE_TYPE (exp)); + type = non_reference (unlowered_expr_type (exp)); /* Peel off cv qualifiers. */ type = TYPE_MAIN_VARIANT (type); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 05dab1f46a7a..f0eabfcbe930 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-10-11 Jakub Jelinek + + PR c++/87547 + * g++.dg/rtti/typeid12.C: New test. + 2018-10-10 Eric Botcazou * g++.dg/other/pr87574.C: New test. diff --git a/gcc/testsuite/g++.dg/rtti/typeid12.C b/gcc/testsuite/g++.dg/rtti/typeid12.C new file mode 100644 index 000000000000..a64d9c3059d2 --- /dev/null +++ b/gcc/testsuite/g++.dg/rtti/typeid12.C @@ -0,0 +1,16 @@ +// PR c++/87547 +// { dg-do run } + +#include + +struct S { unsigned int a : 4; unsigned int b : 12; int c; unsigned long d : 8; } s; + +int +main () +{ + if (typeid (s.a) != typeid (unsigned int) + || typeid (s.b) != typeid (unsigned int) + || typeid (s.c) != typeid (int) + || typeid (s.d) != typeid (unsigned long)) + __builtin_abort (); +}