The attached patch removes the assumption that the initializer for a flexible array member is an array of the same cv-qualified type as the array, avoiding the ICE.
Martin
PR c++/69912 - [6 regression] ICE in build_ctor_subob_ref initializing a flexible array member gcc/testsuite/ChangeLog: 2016-02-23 Martin Sebor <mse...@redhat.com> PR c++/69912 * g++.dg/ext/flexary15.C: New test. gcc/cp/ChangeLog: 2016-02-23 Martin Sebor <mse...@redhat.com> PR c++/69912 * tree.c (build_ctor_subob_ref): Compare types' main variants instead of the types as they are. Index: gcc/cp/tree.c =================================================================== --- gcc/cp/tree.c (revision 233652) +++ gcc/cp/tree.c (working copy) @@ -2592,8 +2592,10 @@ build_ctor_subob_ref (tree index, tree t { /* When the destination object refers to a flexible array member verify that it matches the type of the source object except - for its domain. */ - gcc_assert (comptypes (type, objtype, COMPARE_REDECLARATION)); + for its domain and qualifiers. */ + gcc_assert (comptypes (TYPE_MAIN_VARIANT (type), + TYPE_MAIN_VARIANT (objtype), + COMPARE_REDECLARATION)); } else gcc_assert (same_type_ignoring_top_level_qualifiers_p (type, objtype)); Index: gcc/testsuite/g++.dg/ext/flexary15.C =================================================================== --- gcc/testsuite/g++.dg/ext/flexary15.C (revision 0) +++ gcc/testsuite/g++.dg/ext/flexary15.C (working copy) @@ -0,0 +1,14 @@ +// PR c++/69912 - [6 regression] ICE in build_ctor_subob_ref initializing +// a flexible array member +// { dg-do compile } +// { dg-options "-Wno-pedantic -Wno-write-strings -fpermissive" } + +struct S { + int n; + char *a[]; +}; + +void foo (const char *a) +{ + const S s = { 1, { a, "b" } }; // { dg-warning "invalid conversion" } +}