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

--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <[email protected]>:

https://gcc.gnu.org/g:6e9cf03a7602055b534a0bb1f0219d9d35104c2e

commit r16-7096-g6e9cf03a7602055b534a0bb1f0219d9d35104c2e
Author: Alex Yesmanchyk <[email protected]>
Date:   Tue Jan 27 21:07:07 2026 -0500

    c++: Error diagnostics for pointer-to-member type [PR38612]

    Consider the following ptrtomem4.C file.

    Now for test1 and test3 it produces the following errors:

    ptrtomem4.C: In function 'int test1(int Base::*, X*)':
    ptrtomem4.C:8:21: error: pointer to member type 'int Base::*' incompatible
with incomplete object type 'X'
    ptrtomem4.C: In function 'int test3(int Base::*, Y*)':
    ptrtomem4.C:22:21: error: pointer to member type 'int Base::*' incompatible
with object type 'Y' because 'Y' is not derived from 'Base'

            PR c++/38612

    gcc/cp/ChangeLog:

            * typeck2.cc (build_m_component_ref): Improve class mismatch
            diagnostic.

    gcc/testsuite/ChangeLog:

            * g++.dg/diagnostic/ptrtomem4.C: New test.

    Signed-off-by: Alex Yesmanchyk <[email protected]>
    Co-authored-by: Jason Merrill <[email protected]>

Reply via email to