[Bug c++/105655] [12 Regression] ICE on invalid deduction

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue May 31 19:31:55 GMT 2022


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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:d81be519fd6547654f1eda6976e95524db7d39b7

commit r12-8442-gd81be519fd6547654f1eda6976e95524db7d39b7
Author: Jason Merrill <jason@redhat.com>
Date:   Wed May 25 12:38:58 2022 -0400

    c++: CTAD with alias and nested template [PR105655]

    Here, alias_ctad_tweaks expect tsubst_decl of a FUNCTION_DECL to return a
    FUNCTION_DECL.  A reasonable expectation, but in this case we were
replacing
    the template args of the class-scope deduction guide with equivalent args,
    so looking in the hash table we found the partial instantiation stored when
    instantiating A<int>, which is a TEMPLATE_DECL.  It's fine for that to be
    what is stored, but tsubst_function_decl should never return it.

            PR c++/105655

    gcc/cp/ChangeLog:

            * pt.cc (build_template_decl): Add assert.
            (tsubst_function_decl): Don't return a template.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/class-deduction-alias13.C: New test.


More information about the Gcc-bugs mailing list