Quuxplusone added a comment.

Peanut gallery says: It seems like `Proto->canThrow()` is already returning the 
correct answer for C++17-and-later: a function declared `throw()` cannot throw. 
So from the POV of C++17-and-later, this could be a simple patch:

  - if (isNoexceptExceptionSpec(EST) && Proto->canThrow() == CT_Cannot) {
  + if (Proto->canThrow() == CT_Cannot) {

and the only reason we can't do this is because C++14-and-earlier needs a 
different behavior.

Meanwhile, it looks as if every other use of `isNoexceptExceptionSpec` (or its 
inverse `isDynamicExceptionSpec`) is related to pretty-printing the exception 
specification, and isn't used for semantics at all.
Perhaps a cleaner way to preserve the current special case for 
C++14-and-earlier is to add a "language version" parameter to `canThrow`, 
and/or introduce an `isEssentiallyNoexcept()` helper:

  - if (isNoexceptExceptionSpec(EST) && Proto->canThrow() == CT_Cannot) {
  + if (Proto->isEssentiallyNoexcept(getLangOpts())) {


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113517

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

Reply via email to