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
This commit is contained in:
Marek Polacek 2019-09-25 13:53:04 +00:00 committed by Marek Polacek
parent 9a3afc3564
commit b134cab0cf
4 changed files with 23 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2019-09-25 Marek Polacek <polacek@redhat.com>
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 <paolo.carlini@oracle.com>
* name-lookup.c (check_extern_c_conflict): Use DECL_SOURCE_LOCATION.

View File

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

View File

@ -1,3 +1,8 @@
2019-09-25 Marek Polacek <polacek@redhat.com>
PR c++/91877 - ICE with converting member of packed struct.
* g++.dg/conversion/packed1.C: New test.
2019-09-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/91896

View File

@ -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 <typename a> class b {
public:
b(const a &);
};
struct {
int *c;
} d;
void e() { b<const int *>(d.c); }