https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:de31f5445b12fd9ab9969dc536d821fe6f0edad0 commit r12-1697-gde31f5445b12fd9ab9969dc536d821fe6f0edad0 Author: Patrick Palka <ppa...@redhat.com> Date: Mon Jun 21 07:54:26 2021 -0400 c++: conversion to base of vbase in NSDMI [PR80431] The delayed processing of conversions to a virtual base in an NSDMI assumes the target base type is a (possibly indirect) virtual base of the current class, but the target base type could also be a base of a virtual base, as in the testcase below. Since such a base isn't a part of CLASSTYPE_VBASECLASSES, we end up miscompiling the testcase due to the call to build_base_path (with binfo=NULL_TREE) silently returning error_mark_node. Fix this by using convert_to_base to build the conversion instead. PR c++/80431 gcc/cp/ChangeLog: * tree.c (bot_replace): Use convert_to_base to build the conversion to the (morally) virtual base. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/nsdmi-virtual1a.C: New test.