Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Cant seen to find the change in gcc13.2 release notes

I had the following issue a couple of days ago when using arm-none-eabi-gcc toolchain on arch linux, which uses gcc13.2 as the gcc version, unlike the toolchain I was using in Ubuntu, I assumed it would be some version stuff so I went to the gcc release page to read the notes: https://gcc.gnu.org/gcc-13/changes.html, but as you will see nothing about redeclaration of templates is mentioned

upon some research I came to this reproducible example:

https://godbolt.org/z/Gse7PKWWz

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Could someone explain why in version 12.3 it is allowed but not in 13.2?
Also I’d assume the constrainst enforced in 13.2 should have been a standard de facto way ago

checked the examples in godbolt

>Solution :

The relevant note is in gcc/cp/ChangeLog:

2023-03-14  Patrick Palka  <...>

        PR c++/96830
        * pt.cc (push_inline_template_parms_recursive): Set
        TEMPLATE_PARMS_CONSTRAINTS.
        (push_template_decl): For an out-of-line declaration, verify
        constraints for each enclosing template scope match those of the
        original template declaratation.


    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-class5.C: New test.
            * g++.dg/cpp2a/concepts-class5a.C: New test.

Could someone explain why in version 12.3 it is allowed but not in 13.2?

12.3 was released before this bugfix was submitted.


The full commit message is:

commit cd5baeb4489b6a953abbc7f02fea457fd9ed2f83
Author: Patrick Palka <...>
Date:   Tue Mar 14 19:14:29 2023 -0400

    c++: redeclaring member of constrained class template [PR96830]

    An out-of-line definition of a member of a constrained class template
    needs to repeat the template's constraints, but it turns out we don't
    verify anywhere that the two sets of constraints match.  This patch
    adds such a check to push_template_decl, nearby a similar consistency
    check for the template parameter list lengths.

            PR c++/96830

    gcc/cp/ChangeLog:

            * pt.cc (push_inline_template_parms_recursive): Set
            TEMPLATE_PARMS_CONSTRAINTS.
            (push_template_decl): For an out-of-line declaration, verify
            constraints for each enclosing template scope match those of the
            original template declaratation.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-class5.C: New test.
            * g++.dg/cpp2a/concepts-class5a.C: New test.
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading