[all-commits] [llvm/llvm-project] 43ef17: [clang] P2266: apply move elision rules on throw e...

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Mon Jun 6 15:08:41 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 43ef17cac172229f8b176b42cf0e5ae6c82adbde
      https://github.com/llvm/llvm-project/commit/43ef17cac172229f8b176b42cf0e5ae6c82adbde
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2022-06-07 (Tue, 07 Jun 2022)

  Changed paths:
    M clang/lib/Sema/SemaExprCXX.cpp
    M clang/test/CXX/class/class.init/class.copy.elision/p3.cpp

  Log Message:
  -----------
  [clang] P2266: apply move elision rules on throw expr nested in function prototypes

Our rules to determine if the throw expression are within the variable
scope were giving a false negative result in case the throw expression
would appear within a decltype in a nested function declaration.

Per P2266R3, the relevant rule is: [expr.prim.id.unqual]/2
```
    if the id-expression (possibly parenthesized) is the operand of a throw-expression, and names an implicitly movable entity that belongs to a scope that does not contain the compound-statement of the innermost lambda-expression, try-block , or function-try-block (if any) whose compound-statement or ctor-initializer encloses the throw-expression.
```

This fixes PR54341.

Signed-off-by: Matheus Izvekov <mizvekov at gmail.com>

Reviewed By: rsmith

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




More information about the All-commits mailing list