rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Seems reasonable. I think we need similar handling for `CXXDefaultInitExpr`, 
for cases like this:

  int a;
  struct X { int b = ++a; };
  int c = X{} + a;



================
Comment at: clang/test/SemaCXX/warn-unsequenced.cpp:282-283
+  void test() {
+    // TODO: Consider adding a remark indicating the function call where
+    // the default argument was used.
+    int b;
----------------
I think it's important that we handle this in the near future (though I don't 
mind if you'd like to submit this patch as-is and deal with this as a 
follow-on). For a case like:

```
void f(int, int = a++);
// ... some time later ...
f(a);
```

... a warning that only gives the location of the default argument is not 
useful. We need to show both locations (and potentially a path through multiple 
default arguments, I suppose; yuck).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81003



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to