File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 33
33
\end {codeblock }
34
34
\end {example }
35
35
36
+ \diffref {expr.delete }
37
+ \change
38
+ Calling \tcode {delete} on a pointer to an incomplete class is ill-formed.
39
+ \rationale
40
+ Reduce undefined behavior.
41
+ \effect
42
+ A valid \CppXXIII {} program that that calls \tcode {delete} on an incomplete
43
+ class type is ill-formed.
44
+ \begin {example }
45
+ \begin {codeblock }
46
+ struct S;
47
+
48
+ void f(S *p) {
49
+ delete p; // ill-formed; previously well-formed
50
+ }
51
+
52
+ struct S {};
53
+ \end {codeblock }
54
+ \end {example }
55
+
36
56
\rSec 2[diff.cpp23.dcl.dcl]{\ref {dcl.dcl }: Declarations}
37
57
38
58
\diffref {dcl.init.list }
Original file line number Diff line number Diff line change 5853
5853
5854
5854
\pnum
5855
5855
\indextext {type!incomplete}%
5856
- If the object being deleted has incomplete class type at the point of
5857
- deletion and the complete class has a non-trivial destructor or a
5858
- deallocation function, the behavior is undefined.
5856
+ If the object being deleted has incomplete class type at the point of deletion,
5857
+ the program is ill-formed.
5859
5858
5860
5859
\pnum
5861
5860
\indextext {\idxcode {delete}!destructor and}%
You can’t perform that action at this time.
0 commit comments