From: Marek Polacek Date: Wed, 25 Sep 2019 13:53:04 +0000 (+0000) Subject: PR c++/91877 - ICE with converting member of packed struct. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b134cab0cfb4283b3b5581d81ae777d684af82a9;p=gcc.git PR c++/91877 - ICE with converting member of packed struct. * call.c (convert_like_real): Use similar_type_p in an assert. * g++.dg/conversion/packed1.C: New test. From-SVN: r276127 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ca317e7730b..1d30cef717e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2019-09-25 Marek Polacek + + PR c++/91877 - ICE with converting member of packed struct. + * call.c (convert_like_real): Use similar_type_p in an assert. + 2019-09-25 Paolo Carlini * name-lookup.c (check_extern_c_conflict): Use DECL_SOURCE_LOCATION. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 77f10a9f5f1..45b984ecb11 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -7382,8 +7382,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, tree type = TREE_TYPE (ref_type); cp_lvalue_kind lvalue = lvalue_kind (expr); - gcc_assert (same_type_ignoring_top_level_qualifiers_p - (type, next_conversion (convs)->type)); + gcc_assert (similar_type_p (type, next_conversion (convs)->type)); if (!CP_TYPE_CONST_NON_VOLATILE_P (type) && !TYPE_REF_IS_RVALUE (ref_type)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bf03a5e3c9e..8830baa3aba 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-09-25 Marek Polacek + + PR c++/91877 - ICE with converting member of packed struct. + * g++.dg/conversion/packed1.C: New test. + 2019-09-25 Richard Biener PR tree-optimization/91896 diff --git a/gcc/testsuite/g++.dg/conversion/packed1.C b/gcc/testsuite/g++.dg/conversion/packed1.C new file mode 100644 index 00000000000..c4be930bc19 --- /dev/null +++ b/gcc/testsuite/g++.dg/conversion/packed1.C @@ -0,0 +1,12 @@ +// PR c++/91877 - ICE with converting member of packed struct. +// { dg-do compile { target c++11 } } +// { dg-options "-fpack-struct" } + +template class b { +public: + b(const a &); +}; +struct { + int *c; +} d; +void e() { b(d.c); }