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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathaniel Shead <[email protected]>:

https://gcc.gnu.org/g:4711901000ab141dbf3995ec4541f9d9a2351472

commit r16-5317-g4711901000ab141dbf3995ec4541f9d9a2351472
Author: Nathaniel Shead <[email protected]>
Date:   Sat Nov 15 15:11:55 2025 +1100

    c++/modules: Keep tracking instantiations of static class variable
templates [PR122625]

    r16-4930-gfd5c057c2d01 ensured that we noted all class-scope variables.
    But I also added a clause to 'read_var_def' to skip all class-scope
    instantiations, under the mistaken belief that this would be handled in
    read_class_def.

    But as the testcase shows, read_class_def cannot (and should not)
    register instantiations of member variable templates, as when reading
    the class it just sees the template declaration.  So this patch
    re-enables tracking instantiations of class-scope variable templates.

            PR c++/122625

    gcc/cp/ChangeLog:

            * module.cc (trees_in::read_var_def): Also track class-scope
            primary template specialisations.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/inst-7_a.C: New test.
            * g++.dg/modules/inst-7_b.C: New test.

    Signed-off-by: Nathaniel Shead <[email protected]>
    Reviewed-by: Jason Merrill <[email protected]>

Reply via email to