- Title
- Address of incomplete type vs operator&()
- Status
- cd3
- Section
- 7.6.2.2 [expr.unary.op]
- Submitter
- Richard Smith
Created on 2012-02-07.00:00:00 last changed 152 months ago
Messages
Date: 2012-10-15.00:00:00
[Moved to DR at the October, 2012 meeting.]
Date: 2012-02-15.00:00:00
Proposed resolution (February, 2012): Change 7.6.2.2 [expr.unary.op] paragraph 5 as follows:
The address of an object of incomplete type can be taken, but if
the complete type of that object is a class type that declares
operator&() as a member function, then the behavior is
undefined (and no diagnostic is required). If
& is applied to an lvalue of incomplete class type and
the complete type declares operator&() , it is unspecified
whether the operator has the built-in meaning or the operator function
is called. The operand of & shall not be a
bit-field.
Date: 2026-07-25.21:52:10
According to 7.6.2.2 [expr.unary.op] paragraph 5, This should actually be “ill-formed, no diagnostic
required” instead of undefined behavior, since the problem
could be detected by whole-program analysis. Also, it's not clear
what this means for constant expressions.
The address of an object of incomplete type can be taken, but if the
complete type of that object is a class type that declares
operator&() as a member function, then the behavior is
undefined (and no diagnostic is required).
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2014-03-03 00:00:00 | admin | set | status: drwp -> cd3 |
| 2013-05-03 00:00:00 | admin | set | status: dr -> drwp |
| 2012-11-03 00:00:00 | admin | set | messages: + msg4133 |
| 2012-11-03 00:00:00 | admin | set | status: ready -> dr |
| 2012-02-27 00:00:00 | admin | set | messages: + msg3703 |
| 2012-02-07 00:00:00 | admin | create | |