Movatterモバイル変換


[0]ホーム

URL:


Issue 1958 - WG21 CWG Issues
Title
decltype(auto) with parenthesized initializer
Status
cd4
Section
9.2.9.7 [dcl.spec.auto]
Submitter
Vinny Romano

Created on2014-06-30.00:00:00 last changed109 months ago

Messages

msg6051 (view)
Date: 2015-05-15.00:00:00

[Moved to DR at the May, 2015 meeting.]

msg5313 (view)
Date: 2015-04-15.00:00:00

Proposed resolution (April, 2015):

Change 9.2.9.7 [dcl.spec.auto] paragraph 7 as follows:

...If the placeholder isthedecltype(auto)type-specifier, the declaredtype of the variable or return type of the function shall be theplaceholder alone. The type deduced for the variable or returntype is determined as described in 9.2.9.3 [dcl.type.simple],as thoughtheinitializerinitializer-clauseorexpression-list of theinitializer ortheexpression of thereturn statement hadbeen the operand of the decltype. [Example:
  int i;  int&& f();  auto           x2a(i);    //decltype(x2a) isint  decltype(auto) x2d(i);    //decltype(x2d) isint  auto           x3a = i;   //decltype(x3a) isint  decltype(auto) x3d = i;   //decltype(x3d) isint  ...
msg5202 (view)
Date: 2014-06-30.00:00:00

According to 9.2.9.7 [dcl.spec.auto] paragraph 7,

If the placeholder is thedecltype(auto)type-specifier, the declared type ofthe variable or return type of the function shall be theplaceholder alone. The type deduced for the variable orreturn type is determined as described in9.2.9.3 [dcl.type.simple], as though the initializer hadbeen the operand of thedecltype.

This is problematic when the parenthesized form ofinitializeris used, e.g.,

  int i;  decltype(auto) x(i);

the specification would deduce the type asdecltype((i)),orint&. The wording should be clarified that theexpression and not the entireinitializer is consideredto be the operand ofdecltype.

History
DateUserActionArgs
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-11-10 00:00:00adminsetstatus: dr -> drwp
2015-05-25 00:00:00adminsetmessages: +msg6051
2015-05-25 00:00:00adminsetstatus: tentatively ready -> dr
2015-04-13 00:00:00adminsetmessages: +msg5313
2015-04-13 00:00:00adminsetstatus: drafting -> tentatively ready
2014-06-30 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp