[PATCH] D65696: Implements CWG 2082 Referring to parameters in unevaluated operands of default arguments

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 3 16:55:51 PDT 2019


rsmith added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:103-105
+      //   A local variable cannot be odr-used (6.2) in a default argument.
+      if (DRE->isNonOdrUse() != NOUR_None)
+        return false;
----------------
Please add tests for the distinction between "potentially-evaluated" and "odr-used" here, for example:

```
void f() {
  const int n = 123;
  void g(int k = n); // ok, not an odr-use
}
```


================
Comment at: clang/www/cxx_dr_status.html:3
           "http://www.w3.org/TR/html4/strict.dtd">
 <!-- This file is auto-generated by make_cxx_dr_status. Do not modify. -->
 <html>
----------------
Note that this is an auto-generated file. To update it, you need to add a test to the relevant file (`test/CXX/drs/dr20xx.cpp`) with a suitable comment (`// dr2082: 10` to mark this implemented in Clang 10), grab a recent `cwg_index.html` file, and run the `make_cxx_dr_status` script.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65696





More information about the cfe-commits mailing list