Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[expr.reinterpret.cast] p2 The meaning of "its own type" is not clear #5509

Copy link
Copy link
Open
@xmh0511

Description

@xmh0511
Issue body actions

[expr.reinterpret.cast] p2 says

An expression of integral, enumeration, pointer, or pointer-to-member type can be explicitly converted to its own type; such a cast yields the value of its operand.

What does "its own type" mean? Does it mean the identical original type or something else? Consider this example:

reinterpret_cast<int>(10);
reinterpret_cast<int const>(10);
reinterpret_cast<int volatile>(10);
reinterpret_cast<int const volatile>(10);

Both GCC and Clang accept this example. I think such a conversion is intended to be regulated by [expr.reinterpret.cast] p2. Because p1 says

Conversions that can be performed explicitly using reinterpret_­cast are listed below. No other conversion can be performed explicitly using reinterpret_­cast.

Except that p2 might be relevant to this example, all other rules are irrelevant to the above example. It is necessary to clarify what "its own type" means. Presumably, it means

An expression of integral, enumeration, pointer, or pointer-to-member type can be explicitly converted to the cv-unqualified version or cv-qualification of that type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.