[PATCH] D81615: [clang] CWG 2082 and 2346: loosen the restrictions on parameters and local variables in default arguments.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 10 17:47:28 PDT 2020


rsmith added inline comments.


================
Comment at: clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p9.cpp:8
+  // expected-error at -1 {{default argument references parameter 'x'}}
+  void f4(int x, int y = x + 0);
+  // expected-error at -1 {{default argument references parameter 'x'}}
----------------
I'd like to see an example like:
```
void f5(int x, int y = ((void)x, 0));
```
to demonstrate that we're checking for potentially-evaluated mentions, not odr-uses, here. (`(void)x` is not an odr-use, but is potentially-evaluated.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81615/new/

https://reviews.llvm.org/D81615





More information about the cfe-commits mailing list