mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-25 06:18:56 -04:00

In the test, y1 is not reference compatible to y2 and we currently assume the cast is ill-formed so we emit a diagnostic. Instead, in order to honour the standard, if y1 it's not reference-compatible to y2 then it can't be converted using a static_cast, and a reinterpret_cast should be tried instead. Richard Smith provided the correct interpretation of the standard and explanation about the subtle difference between "can't be cast" and "the cast is ill-formed". The former applies in this case. PR: 23802 llvm-svn: 241998
9 lines
170 B
C++
9 lines
170 B
C++
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
|
|
// expected-no-diagnostics
|
|
|
|
struct S {};
|
|
int x;
|
|
S&& y1 = (S&&)x;
|
|
S&& y2 = reinterpret_cast<S&&>(x);
|
|
S& z1 = (S&)x;
|