[clang] CWG 2082 and 2346: loosen the restrictions on parameters and local variables...
authorBruno Ricci <riccibrun@gmail.com>
Thu, 11 Jun 2020 11:41:08 +0000 (12:41 +0100)
committerBruno Ricci <riccibrun@gmail.com>
Thu, 11 Jun 2020 11:41:08 +0000 (12:41 +0100)
commit5951ff4512332fff9d191da8661143a883d3b8aa
tree1d59a878b97cf96ef01cd17de8721093de8feebe
parent0418005c0e2f280f0cdab9ad7b5a1a7bd03d9c10
[clang] CWG 2082 and 2346: loosen the restrictions on parameters and local variables in default arguments.

This patch implements the resolution of CWG 2082 and CWG 2346.

The resolution of CWG 2082 changed [dcl.fct.default]p7 and p9 to allow
a parameter or local variable to appear in a default argument if not
in a potentially-evaluated expression.

The resolution of CWG 2346 changed [dcl.fct.default]p7 to allow a local
variable to appear in a default argument if not odr-used.

An issue remains after this patch
(see the FIXME in test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p7.cpp).
This is addressed by the next patch.

Differential Revision: https://reviews.llvm.org/D81615

Reviewed By: rsmith, erichkeane
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p7.cpp
clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p8.cpp
clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p9.cpp [new file with mode: 0644]
clang/test/CXX/drs/dr20xx.cpp
clang/test/CXX/drs/dr23xx.cpp