c++: Fix constexpr vs. reference parameter.
authorJason Merrill <jason@redhat.com>
Mon, 3 Feb 2020 21:03:45 +0000 (16:03 -0500)
committerJason Merrill <jason@redhat.com>
Mon, 3 Feb 2020 22:52:17 +0000 (17:52 -0500)
commit87fbd5347b33883006dc77e779b9edc590fcd2f0
tree348baf29ff78fbda5e5cbdf5556c0aeebb6509d6
parent8fda2c274ac66d60c1dfc1349e9efb4e8c2a3580
c++: Fix constexpr vs. reference parameter.

[expr.const] specifically rules out mentioning a reference even if its
address is never used, because it implies indirection that is similarly
non-constant for a pointer variable.

PR c++/66477
* constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
defer loading the value of a reference.
gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr6.C
gcc/testsuite/g++.dg/cpp0x/constexpr-ref12.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/lambda-generic-const10.C