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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <ja...@gcc.gnu.org>:

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

commit r15-9542-gac31e41c584c59f8f2e381d545235a32b7c9e406
Author: Jason Merrill <ja...@redhat.com>
Date:   Tue Aug 31 17:01:22 2021 -0400

    c++: ill-formed constexpr function [PR113360]

    If we already gave an error while parsing a function, we don't also need to
    try to explain what's wrong with it when we later try to use it in a
    constant-expression.  In the new testcase explain_invalid_constexpr_fn
    couldn't find anything still in the function to complain about, so it said
    because: followed by nothing.

    We still try to constant-evaluate it to reduce error cascades, but we
    shouldn't complain if it doesn't work very well.

    This flag is similar to CLASSTYPE_ERRONEOUS that I added a while back.

            PR c++/113360

    gcc/cp/ChangeLog:

            * cp-tree.h (struct language_function): Add erroneous bit.
            * constexpr.cc (explain_invalid_constexpr_fn): Return if set.
            (cxx_eval_call_expression): Quiet if set.
            * parser.cc (cp_parser_function_definition_after_declarator)
            * pt.cc (instantiate_body): Set it.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp23/constexpr-nonlit18.C: Remove redundant message.
            * g++.dg/cpp1y/constexpr-diag2.C: New test.
            * g++.dg/cpp1y/pr63996.C: Adjust expected errors.
            * g++.dg/template/explicit-args6.C: Likewise.
            * g++.dg/cpp0x/constexpr-ice21.C: Likewise.

Reply via email to