PR c++/89331 - ICE with offsetof in incomplete class.
authorJason Merrill <jason@redhat.com>
Wed, 3 Apr 2019 20:09:17 +0000 (16:09 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 3 Apr 2019 20:09:17 +0000 (16:09 -0400)
commitb8836dbec1a36eb3a00c789a4ed1e64ba28ee6fe
tree2d7e515d7d3bb8d8b8a27503153cb5124dc1de94
parentbc53dee0baa3f3e06c89081ef01f506037acd1ff
PR c++/89331 - ICE with offsetof in incomplete class.

We were aborting when build_base_path returned an error because of the
derived class not being complete yet, which wasn't considered by the assert.
Fixed by checking for complete type first.  The semantics.c change avoids
a duplicate error message.

* semantics.c (finish_offsetof): Handle error_mark_node.
* typeck.c (build_class_member_access_expr): Call
complete_type_or_maybe_complain before converting to base.

From-SVN: r270135
gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/cp/typeck.c
gcc/testsuite/g++.dg/ext/builtin-offsetof4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/other/offsetof8.C