[clang] [Clang] Implement __reference_converts_from_temporary (PR #91199)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu May 9 06:55:26 PDT 2024
================
@@ -5627,6 +5627,77 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT,
static bool EvaluateBinaryTypeTrait(Sema &Self, TypeTrait BTT, const TypeSourceInfo *Lhs,
const TypeSourceInfo *Rhs, SourceLocation KeyLoc);
+static ExprResult CheckConvertibilityForTypeTraits(Sema &Self,
+ const TypeSourceInfo *Lhs,
+ const TypeSourceInfo *Rhs,
+ SourceLocation KeyLoc) {
+
+ QualType LhsT = Lhs->getType();
+ QualType RhsT = Rhs->getType();
+
+ // C++0x [meta.rel]p4:
+ // Given the following function prototype:
+ //
+ // template <class T>
+ // typename add_rvalue_reference<T>::type create();
+ //
+ // the predicate condition for a template specialization
+ // is_convertible<From, To> shall be satisfied if and only if
+ // the return expression in the following code would be
+ // well-formed, including any implicit conversions to the return
+ // type of the function:
+ //
+ // To test() {
+ // return create<From>();
+ // }
+ //
+ // Access checking is performed as if in a context unrelated to To and
----------------
erichkeane wrote:
Do you have a test for this access checking? I would expect something conversion ops/ctors that are protected, but they are friends of eachother.
https://github.com/llvm/llvm-project/pull/91199
More information about the cfe-commits
mailing list