https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86633

            Bug ID: 86633
           Summary: invalid with rvalue references
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhonghao at pku dot org.cn
  Target Milestone: ---

The code is as follow:

int x = reinterpret_cast<const int&&>(1.0f);

Consensus on IRC is that this is invalid.

g++ accepts it, but clang++ rejects it:

code0.cpp:1:9: error: reinterpret_cast from rvalue to reference type
      'const int &&'
int x = reinterpret_cast<const int&&>(1.0f);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Reply via email to