From: Jakub Jelinek Date: Thu, 11 Oct 2018 07:07:22 +0000 (+0200) Subject: re PR c++/87547 (G++ reports bad type names for bit-field members) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f7904392b7b6ce8a9949b62692342f3c1cdc3621;p=gcc.git re PR c++/87547 (G++ reports bad type names for bit-field members) PR c++/87547 * rtti.c (get_tinfo_decl_dynamic): Use unlowered_expr_type instead of TREE_TYPE. * g++.dg/rtti/typeid12.C: New test. From-SVN: r265033 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index af8cb764139..0ac28f934d9 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 94a92198781..a0629e19360 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 05dab1f46a7..f0eabfcbe93 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 00000000000..a64d9c3059d --- /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 (); +}