|
7005 | 7005 | \end{itemize} |
7006 | 7006 |
|
7007 | 7007 | \pnum |
7008 | | -An explicitly defaulted special member function $\tcode{F}_1$ |
7009 | | -is allowed to differ from |
7010 | | -the corresponding special member function $\tcode{F}_2$ |
7011 | | -that would have been implicitly declared, as follows: |
| 7008 | +The program is ill-formed |
| 7009 | +if an explicitly defaulted special member function $\tcode{F}_1$ |
| 7010 | +of class \tcode{C} |
| 7011 | +differs from the corresponding special member function $\tcode{F}_2$ |
| 7012 | +that would have been implicitly declared |
| 7013 | +other than as follows: |
7012 | 7014 | \begin{itemize} |
7013 | 7015 | \item |
7014 | | - $\tcode{F}_1$ and $\tcode{F}_2$ may have differing \grammarterm{ref-qualifier}{s}; |
| 7016 | + if $\tcode{F}_1$ is an assignment operator, |
| 7017 | + it may have the \tcode{\&} \grammarterm{ref-qualifier}; |
7015 | 7018 | \item |
7016 | | - if $\tcode{F}_2$ has an implicit object parameter of |
7017 | | - type ``reference to \tcode{C}'', |
7018 | | - $\tcode{F}_1$ may be an explicit object member function whose |
7019 | | - explicit object parameter is of (possibly different) type ``reference to \tcode{C}'', |
| 7019 | + if $\tcode{F}_2$ is an assignment operator |
| 7020 | + (which has an implicit object parameter |
| 7021 | + of type ``lvalue reference to \tcode{C}''), |
| 7022 | + $\tcode{F}_1$ may have an explicit object parameter |
| 7023 | + of type ``lvalue reference to \tcode{C}'', |
7020 | 7024 | in which case the type of $\tcode{F}_1$ would differ from the type of $\tcode{F}_2$ |
7021 | 7025 | in that the type of $\tcode{F}_1$ has an additional parameter; |
7022 | 7026 | \item |
7023 | | - $\tcode{F}_1$ and $\tcode{F}_2$ may have differing exception specifications; and |
| 7027 | + $\tcode{F}_1$ and $\tcode{F}_2$ may have differing exception specifications; |
7024 | 7028 | \item |
7025 | | - if $\tcode{F}_2$ has a non-object parameter of type \tcode{const C\&}, |
7026 | | - the corresponding non-object parameter of $\tcode{F}_1$ may be of |
7027 | | - type \tcode{C\&}. |
7028 | | -\end{itemize} |
7029 | | -If the type of $\tcode{F}_1$ differs from the type of $\tcode{F}_2$ in a way |
7030 | | -other than as allowed by the preceding rules, then: |
7031 | | -\begin{itemize} |
7032 | | -\item |
7033 | | - if $\tcode{F}_1$ is an assignment operator, and |
7034 | | - the return type of $\tcode{F}_1$ differs from |
7035 | | - the return type of $\tcode{F}_2$ or |
7036 | | - $\tcode{F}_1${'s} non-object parameter type is not a reference, |
7037 | | - the program is ill-formed; |
7038 | | -\item |
7039 | | - otherwise, if $\tcode{F}_1$ is explicitly defaulted on its first declaration, |
7040 | | - it is defined as deleted; |
| 7029 | + if $\tcode{F}_2$ has a non-object parameter |
| 7030 | + of type ``lvalue reference to const \tcode{C}'', |
| 7031 | + the corresponding non-object parameter of $\tcode{F}_1$ may be |
| 7032 | + of type ``lvalue reference to \tcode{C}''; and |
7041 | 7033 | \item |
7042 | | - otherwise, the program is ill-formed. |
| 7034 | + if $\tcode{F}_2$ has a non-object parameter |
| 7035 | + of type ``lvalue reference to \tcode{C}'', |
| 7036 | + the corresponding non-object parameter of $\tcode{F}_1$ may be |
| 7037 | + of type ``lvalue reference to const \tcode{C}''; |
| 7038 | + in this case only, $\tcode{F}_1$ is defined as deleted |
| 7039 | + if it is explicitly defaulted on its first declaration and |
| 7040 | + the program is ill-formed otherwise. |
7043 | 7041 | \end{itemize} |
7044 | 7042 |
|
7045 | 7043 | \pnum |
|
0 commit comments