https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113757
--- Comment #5 from Sam James <sjames at gcc dot gnu.org> --- reduced but with return-type UB: ``` template <typename _Alloc> struct __alloc_traits { typedef typename _Alloc::value_type &const_reference; }; struct LegionAllocator { typedef int value_type; }; struct vector { long size() const; __alloc_traits<LegionAllocator>::const_reference operator[](long) const; }; void __assert_fail(); template <typename> using LegionVector = vector; struct TaskOp { virtual int &get_version_info(); } *slice_owner; struct PointTask { virtual const int &get_version_info() const; LegionVector<int> version_infos; }; int &TaskOp::get_version_info() { __assert_fail(); } const int &PointTask::get_version_info() const { if (version_infos.size()) return version_infos[0]; return slice_owner->get_version_info(); } ```