[Bug c++/89331] [8/9 Regression] internal compiler error: in build_simple_base_path, at cp/class.c:589

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 3 20:09:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89331

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Wed Apr  3 20:09:17 2019
New Revision: 270135

URL: https://gcc.gnu.org/viewcvs?rev=270135&root=gcc&view=rev
Log:
        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.

Added:
    trunk/gcc/testsuite/g++.dg/ext/builtin-offsetof4.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/g++.dg/other/offsetof8.C


More information about the Gcc-bugs mailing list