Movatterモバイル変換


[0]ホーム

URL:


Issue 1458 - WG21 CWG Issues
Title
Address of incomplete type vs operator&()
Status
cd3
Section
7.6.2.2 [expr.unary.op]
Submitter
Richard Smith

Created on2012-02-07.00:00:00 last changed145 months ago

Messages

msg4133 (view)
Date: 2012-10-15.00:00:00

[Moved to DR at the October, 2012 meeting.]

msg3703 (view)
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 ifthe complete type of that object is a class type that declaresoperator&() as a member function, then the behavior isundefined (and no diagnostic is required).If& is applied to an lvalue of incomplete class type andthe complete type declaresoperator&(), it is unspecifiedwhether the operator has the built-in meaning or the operator functionis called. The operand of& shall not be abit-field.
msg3702 (view)
Date: 2012-02-07.00:00:00

According to 7.6.2.2 [expr.unary.op] paragraph 5,

The address of an object of incomplete type can be taken, but if thecomplete type of that object is a class type that declaresoperator&() as a member function, then the behavior isundefined (and no diagnostic is required).

This should actually be “ill-formed, no diagnosticrequired” instead of undefined behavior, since the problemcould be detected by whole-program analysis. Also, it's not clearwhat this means for constant expressions.

History
DateUserActionArgs
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2013-05-03 00:00:00adminsetstatus: dr -> drwp
2012-11-03 00:00:00adminsetmessages: +msg4133
2012-11-03 00:00:00adminsetstatus: ready -> dr
2012-02-27 00:00:00adminsetmessages: +msg3703
2012-02-07 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp