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
This commit is contained in:
Jakub Jelinek 2018-10-11 09:07:22 +02:00 committed by Jakub Jelinek
parent 6b0649cba3
commit f7904392b7
4 changed files with 28 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2018-10-11 Jakub Jelinek <jakub@redhat.com>
PR c++/87547
* rtti.c (get_tinfo_decl_dynamic): Use unlowered_expr_type instead
of TREE_TYPE.
2018-10-10 Marek Polacek <polacek@redhat.com>
PR c++/87567 - constexpr rejects call to non-constexpr function.

View File

@ -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);

View File

@ -1,3 +1,8 @@
2018-10-11 Jakub Jelinek <jakub@redhat.com>
PR c++/87547
* g++.dg/rtti/typeid12.C: New test.
2018-10-10 Eric Botcazou <ebotcazou@adacore.com>
* g++.dg/other/pr87574.C: New test.

View File

@ -0,0 +1,16 @@
// PR c++/87547
// { dg-do run }
#include <typeinfo>
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 ();
}