Skip to content

[dcl.type.simple] erroneous example #60

Closed
@sdutoit

Description

@sdutoit

From an email to cxxeditor@:

I just notice that the example in [dcl.type.simple]

const int&& foo();
int i;
[..]
decltype(foo()) x1 = i; // type is const int&&

looks erroneous. The defect is that you cannot initialize a variable
"const int&&" with an lvalue of int (as shown here). A possible fix
would be to write this as:

const int&& foo();
[..]
decltype(foo()) x1 = 0; // type is const int&&

(this is: Including a strike of the variable 'i').

My understanding is that this is an editorial defect, because

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#651

already suggested a fix of the examples here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    tinyAn issue with a small change; with "cwg" label: can be applied editorially after CWG consent.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions