Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
22546a3
CWG1621 Member initializers in anonymous unions
Nov 12, 2019
d14f1de
CWG2126 Lifetime-extended temporaries in constant expressions
Nov 12, 2019
f650aef
CWG2282 Consistency with mismatched aligned/non-over-aligned allocati…
Nov 12, 2019
00e8011
CWG2347 Passing short scoped enumerations to ellipsis
Nov 13, 2019
3daaf90
CWG2374 Overly permissive specification of enum direct-list-initializ…
Nov 13, 2019
9700b13
CWG2399 Unclear referent of “expression” in assignment-expression
Nov 13, 2019
ec29589
CWG2419 Loss of generality treating pointers to objects as one-elemen…
Nov 13, 2019
7e730f8
[basic.compound] [numeric.ops.midpoint] Unify terminology used to
zygoloid Nov 19, 2019
7c9d35d
CWG2422 Incorrect grammar for deduction-guide
Nov 13, 2019
501a10b
CWG2424 constexpr initialization requirements for variant members
Nov 13, 2019
b5fd3b9
CWG2426 Reference to destructor that cannot be invoked
Nov 13, 2019
2c7090e
CWG2427 Deprecation of volatile operands and unevaluated contexts
Nov 13, 2019
e1ed0cc
CWG2429 Initialization of thread_local variables referenced by lambdas
Nov 13, 2019
21f5dec
CWG2430 Completeness of return and parameter types of member functions
Nov 13, 2019
6d05c69
CWG2431 Full-expressions and temporaries bound to references
Nov 13, 2019
b7e6e5e
CWG2432 Return types for defaulted <=>
Nov 13, 2019
2140e55
CWG2433 Variable templates in the ODR
Nov 13, 2019
752c82b
CWG2437 Conversion of std::strong_ordering in a defaulted operator<=>
Nov 13, 2019
fd20a44
CWG2442 Incorrect requirement for default arguments
Nov 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
CWG2426 Reference to destructor that cannot be invoked
  • Loading branch information
Dawn Perchik authored and zygoloid committed Nov 20, 2019
commit b5fd3b94fbf20e326e88ee66f5ce6f2a685ce9f6
3 changes: 2 additions & 1 deletion source/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2307,7 +2307,8 @@
the destructor is invoked.
\end{note}
A destructor can also be invoked explicitly. A destructor is \term{potentially invoked}
if it is invoked or as specified in~\ref{expr.new}, \ref{dcl.init.aggr},
if it is invoked or as specified in~\ref{expr.new},
\ref{stmt.return}, \ref{dcl.init.aggr},
\ref{class.base.init}, and~\ref{except.throw}.
A program is ill-formed if a destructor that is potentially invoked is deleted
or not accessible from the context of the invocation.
Expand Down
10 changes: 10 additions & 0 deletions source/statements.tex
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,16 @@
}
\end{codeblock}
\end{example}
The destructor for the returned object
is potentially invoked~(\ref{class.dtor}, \ref{except.ctor}).
\begin{example}
\begin{codeblock}
class A {
~A() {}
};
A f() { return A(); } // error: destructor of \tcode{A} is private (even though it is never invoked)
\end{codeblock}
\end{example}
Flowing off the end of
a constructor,
a destructor, or
Expand Down