================ @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -std=c++26 -fsyntax-only -verify %s + +auto&& f1() { + return 42; // expected-error{{returning reference to local temporary object}} +} +const double& f2() { + static int x = 42; + return x; // expected-error{{returning reference to local temporary object}} +} +auto&& id(auto&& r) { + return static_cast<decltype(r)&&>(r); +} +auto&& f3() { + return id(42); // OK, but probably a bug +} + +static_assert(__is_convertible(int, const int &)); +static_assert(__is_nothrow_convertible(int, const int &)); ---------------- yronglin wrote:
Agree to keep these 2 lines and I'll add more test in type-traits.cpp https://github.com/llvm/llvm-project/pull/89942 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits