[Bug c++/91953] [8/9 Regression] G++ rejects lambda with constexpr variable

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 2 21:26:00 GMT 2020


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

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

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

commit r9-8323-gb4e53e9b3c963b1c0fe9637618dec8042764f599
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Mar 2 14:42:47 2020 -0500

    c++: Allow parm of empty class type in constexpr.

    Since copying a class object is defined in terms of the copy constructor,
    copying an empty class is OK even if it would otherwise not be usable in a
    constant expression.  Relatedly, using a parameter as an lvalue is no more
    problematic than a local variable, and calling a member function uses the
    object as an lvalue.

    gcc/cp/ChangeLog
    2020-03-02  Jason Merrill  <jason@redhat.com>

        PR c++/91953
        * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
        empty class type.
        [COMPONENT_REF]: A member function reference doesn't use the object
        as an rvalue.


More information about the Gcc-bugs mailing list